How do I access an array of Colors or floats with Unity's Shader Graph?

Started by
0 comments, last by CassieNova 3 years, 5 months ago

I'm trying to send arrays of colors and floats to my PBR Shader from a script and access them in Shader Graph:

// From Script....

// no an array but using this to access the arrays below...
material.setInt("baseColorsCount", baseColors.Length); 

// Array
material.SetColorArray ("baseColors", baseColors);
material.SetFloatArray ("baseStartHeights", baseStartHeights);

But what property do I select in order to access the values in the graph?

Oh one more thing, how does one iterate through any of these arrays within Shader Graph? How would I do something simple like this:

for (int i = 0; i < baseColorsCount; i += 1) {
   // Do something
}

…but in Shader Graph.

Thanks for reading!

None

This topic is closed to new replies.

Advertisement