Friday 23 February 2018

Accessing Shader Graph properties via code

You can create and name properties in shader graph using the Blackboard


These names really just serve as labels, so if you want to access these properties via code (to use material.SetColor, for example) then you need to peek at the shader code.

Right-click the master node and select 'Copy shader'


Paste that into text editor of choice and look at the Properties code block at the top 



My property was named _ColorTest and the actual name of it is Color_A2.. etc

Now I can do
material.SetColor("Color_A208B217", Color.magenta);

 

No comments:

Post a Comment