Maybe a repeat question: How to make GameObject transparent?

Hello

I found many answers online for this question but none works.

I try to make my gameobject half visible. Here is what most of them recommend:

Renderer ren7 = ball7.GetComponent<Renderer>();
Color dropColor = ren7.material.color;
dropColor.a = 0.5f;
ren7.material.color = dropColor;

It does not work, also, it does not show any errors!

Any advice?

Mirza

Not all shaders can display transparency. First make a custom material for your gameobject and set the shader to Legacy Shaders → Transparent → Diffuse

From that point you can change the transparency with something like that:

gameObject.GetComponent<MeshRenderer> ().material.color = new Color(1.0f, 1.0f, 1.0f, 0.4f);

Hope this helps

Indeed it did help, thanks!