How to make game object transparent in unity

Check for collision. When the collision that you want is triggered then you can change the transparency.

GameObject g;

// 50% Transparency.
g.renderer.material.color.a = 0.5f; // a is the alpha value.

 // 100% Transparency.
g.renderer.material.color.a = 1.0f;

You can do just this to make your program wait time: http://docs.unity3d.com/Documentation/Manual/Coroutines.html

You will notice the example is exactly your question.


Try this extension method:

public static void ChangeAlpha(this Material mat, float alphaValue)
{
    Color oldColor = mat.color;
    Color newColor = new Color(oldColor.r, oldColor.g, oldColor.b, alphaValue);         
    mat.SetColor("_Color", newColor);               
}

You can then call it by:

gameObject.renderer.material.ChangeAlpha( Your Alpha Value );