Set alpha value of game object

Hi Community

I am trying to set alpha value of a game object by writing

lineRightObject.renderer.material.color.a = alpha;

but there is no effect on alpha value,I did’t find any right solution.

can any body help.

Thanks
Eric

You need a shader that supports transparency. To start, create a material and use the Unlit/Transparent shader for your object. Once you verify that your script is working with this shader, you can branch out to other transparent shaders. Note you can find many shaders on the Unity Wiki pages:

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