I am very new to Unity3D and C#. I am making a simple application that changes the transparency of the object (as shown in attachment). When I use the Albedo manually it does the great job, but I want to achieve the same thing with the help of a button. That means when the button is clicked, I get the to make the object opaque or transparent through script.
I’ve seen a lot of code such as
gameobject.GetComponent<Renderer>().material.color… and so on but nothing seems to work when I click the button. I don’t get any errors either
I’d be grateful if someone can help me achieving the Alpha value from 255 to 0 or vice versa on button click event.
Thank you in advance,