- Home /
Change color of tree leaves?
Hello, I need some help. I am trying to mimic the change of seasons in my game, first by changing the color of leaves on trees(green = spring/summer, white = winter, and red/orange/green = autumn). But I am stuck on finding out how to change the color of the leaves of every tree. How should I do this, and what methods do I need. Just as a quick note so I do not need another question, but how do I make it such that I can also make the leaves have a little variation in color, maybe random.range values for RGB.
So I guess the main question is how to set the Color of a material Globally.
Also, I know C#, but not ShaderLab.
Thanks!
Is the material you use the same on all your "trees"?
If you want variance in your leaves, I would have a texture map of some multiple of 4 leave textures each with a different color, then have random leaves UV mapped to different parts of the texture. Random values will not work, because a material is per mesh, not per "leave".
$$anonymous$$aterial references are "global", so just get a reference and change the respective color value.
Your question is quite vague, it would help if you gave something like an example, or explain your setup further. Right now I'm just guessing around.
Your answer
![](https://koobas.hobune.stream/wayback/20220613141107im_/https://answers.unity.com/themes/thub/images/avi.jpg)