I have laser-object in my scene, which I want to be seen only when I press the 'E' button on the key board(just an example of a key). I have seen many ways to change the transparency , however, none of them worked. one of them was -
gameObject.renderer.material.color.a = 0.0f ;
I get an Error - UnityEngine.renderer does not contain color and material sub-functions.
I don't know how to do it, and I tried many ways. Does someone have an easy way to make an object transparent and visible in C# script ? Thank you