- Home /
Set list in shader (uniform)
There is a way to set a list for uniform? Something similar to "material.SetFloatArray" but with list? Or the restriction is for arrays? Also there is possible to change the array during runtime in shaders?
Answer by rageingnonsense · Jul 14, 2017 at 06:41 PM
If I understand you correctly, you want to take the contents of a C# List object and make it available in some way to a shader.
The short answer is no. List is a C# construct. To do that you would have to do:
material.SetFloatArray("myarray", myList.ToArray());
And that List also needs to contain just float values.
As far as changing it during runtime; yes you can. You just need to call the above method whenever you want that value to be different in the shader. It will be on a frame by frame basis though of course.
Your answer
Follow this Question
Related Questions
How to share constant variables between Compute Shaders? 0 Answers
Shader float4 component values computing strangely 0 Answers
Help me understand stencil shader logic 1 Answer
Fog not working in my Shader~ 0 Answers
Sprite Shader not working in 5.6 0 Answers