Search Unity

How to edit values in tree creator leaves optimized shader

Discussion in 'General Graphics' started by Ronald_McScotland, May 26, 2018.

  1. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Hello all,

    What I'm trying to do is to adjust the main color and alpha cutoff of the optimized leaf material generated by the tree creator, so that I can make the appearance of the tree change over the course of a year in-game, by turning orange in autumn, then hiding the leaves in winter by increasing the alpha cutoff, and then regrowing them in spring by reversing the process.

    Unfortunately, all the values in the optimized leaf material are greyed out from editing, and they don't seem to respond to adjusting them from script with material.SetFloat and material.SetColor either. Anyone know a way to edit these values? I'm placing trees as individual game objects, not via terrain system, so the problem isn't related to needing to refresh the tree prototypes in the terrain engine.

    Thanks.
     
  2. Ronald_McScotland

    Ronald_McScotland

    Joined:
    Jul 30, 2014
    Posts:
    174
    Ah, nevermind, it turns out I was using the wrong property names when trying to adjust the values by code (using "Color" when I should have been using "_Color"). All working now.