- Home /
How to toggle a material property in code?
I'd like to turn on/off a material property (_Diffuse, _Normal, etc.) during runtime when the player performs a certain action. Is this possible to do somehow using C#?
I could set the property to null and then set it back to the previous texture, but I'd like a way to toggle the property altogether so I don't have to store the textures in any variable since I'll perform the toggle scene-wide for all gameobjects.
Anyone knows of any solution here?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613161043im_/https://answers.unity.com/themes/thub/images/avi.jpg)