- Home /
Changing Shader Graph texture through Script
Hi,
I have recently been introduced to the shader graph tool so I'm quite new with that. I have no problems with the tool itself, but I would like to acccess it from script and I can't seem to get it working.
I would like to use the same custom shader for different models, each containing a different texture, so I would like to access the texture property of the shader so I can change it while the application is running.
This is the component I am trying to access/change.
Any suggestions on how I could do it? Should I approach the issue in another way?
Any help is appreciated.
Answer by menstroke · Jan 11 at 03:51 PM
You can use material.SetTexture
yourmaterial.SetTexture("yourShaderPropertiesReference", yourTexture);
ShaderPropertiesReference is not properties name make sure your shader properties reference correct.