- Home /
The question is answered, right answer was accepted
material.SetFloat not working
I want to vary variable within a shader, so i am using the material.SetFloat command, and no errors in debug console, but the variable in the shader is not changing, while the variable in the setfloat is changing... here is i screencapture:
Answer by MountDoomTeam · Aug 14, 2013 at 05:45 PM
have to use name of the variable in the shader, not the title of the variable in property.. doh! thanks.
Note if anyone is having trouble with this in URP/HDRP the properties in ShaderGraph have a secondary name... so then using $$anonymous$$aterial.SetFloat(propertyName, value). its actually a different name you need to be using. Change your propName to match that, or change the name in shaderGraph to match the property name.
Follow this Question
Related Questions
How to force the compilation of a shader in Unity? 5 Answers
Accessing shader property breaks shader 0 Answers
How can I get or set textures on a material other than the main texture? (eg, the bump map) 1 Answer
How can I access a shader value 1 Answer
fragment Shader -> get the current pixel color int the color Buffer :D 1 Answer