unity3d etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
unity3d etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

21 Eylül 2014 Pazar

Unity OnCollisionEnter - OnTriggerEnter

Some notes:

In order to work with OnCollisionEnter:

At least one object should have a non-kinematic Rigidbody and the IsTrigger option of the Collider should be not checked. Both objects should have Colliders attached.

To work with OnTriggerEnter

At least one object should have a Rigidbody and both should have Colliders with IsTrigger option attached.


These options are probably same for the OnCollisionEnter2d and OnTriggerEnter2d.
You should use Collider2d and Rigidbody2D instead

Good luck : )

3 Haziran 2014 Salı

Unity - Default clip could not be found in attached animations list

Hi,
When I was dealing with mechanim anims in unity, I needed to use the legacy animations, but I have seen the error on the subject when I was trying to access the animation.

In order to fix that, Click on your animation, go upper-right corner to the settings icon, change it to Debug and set the AnimationType to 1


Voila !


$Unity - LoadingScene.unity - runner_unity - Android_ 2014-02-10 16.33.02.png


Source:
http://forum.unity3d.com/threads/legacy-animations-dont-work.159980/

5 Mart 2014 Çarşamba

NGUI Button isEnabled does not work BUG

Yeah,
If you set isEnabled = false of a UIButton in NGUI, the color of the button does not change even it is disabled.

It is a bug actually, you should change the NGUI isEnabled source code as follows:

public bool isEnabled
    {
        get
        {
            if (!enabled) return false;
            Collider col = collider;
            return col && col.enabled;
        }
        set
        {
            Collider col = collider;
            if (col != null) col.enabled = value;
            else enabled = value;
            UpdateColor(value, false);
        }
    }


Here is the link:
http://www.tasharen.com/forum/index.php?topic=6893.msg32520#msg32520

Note:
This bug is fixed after 3.x version, not sure which exactly.


10 Ekim 2013 Perşembe

Vertex Color Shader in unity

Hi,
I have realized Unity3d does not have a shader for vertex colored models.

Since it is one of the easiest ways to color your model in Blender (Vertex Painting), you might need this shader:

Go to your assests folder - Create - Shader.
Give a name to your shader and paste the code below: (The name in code is "Vertex Colored", you can change it with your shader name).

Keep in mind, that you need create a material for your model if it is not created. Then you can choose this shader on material's shader list.

And make the ambient light white to see it properly. (Render Settings - Ambient Light)

Cheers


Vertex Color Shader Script

Source:
http://wiki.unity3d.com/index.php?title=VertexColor


Shader " Vertex Colored" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _SpecColor ("Spec Color", Color) = (1,1,1,1)
    _Emission ("Emmisive Color", Color) = (0,0,0,0)
    _Shininess ("Shininess", Range (0.01, 1)) = 0.7
    _MainTex ("Base (RGB)", 2D) = "white" {}
}

SubShader {
    Pass {
        Material {
            Shininess [_Shininess]
            Specular [_SpecColor]
            Emission [_Emission]    
        }
        ColorMaterial AmbientAndDiffuse
        Lighting On
        SeperateSpecular On
        SetTexture [_MainTex] {
            Combine texture * primary, texture * primary
        }
        SetTexture [_MainTex] {
            constantColor [_Color]
            Combine previous * constant DOUBLE, previous * constant
        } 
    }
}

Fallback " VertexLit", 1
}

22 Temmuz 2013 Pazartesi

Unity3d - Round double / float values

Hi,
To be able to round the values in unity csharp you need the code below:


float rawValue = 5.521f;
rawValue = Mathf.Round(rawvalue * 100f) / 100f);
//it should return 5.5



In order to increase decimals, just use 1000 or 10000 etc.