Search code examples
c#unity-game-enginematerials

How do I change my material's shader property at runtime


I have a material whose shader has a opacity property which I want to change at runtime. How do I get the reference to that property.

enter image description here


Solution

  • This is done via Material.SetFloat.

    You'll need to use the actual property reference name as key, not the Inspector display name, e.g.

    enter image description here