- Home /
How can I access my custom firstpass shader properties through script?
Hey,
I have written a custom firstpass shader for my terrain and I want to manually assign a texture to one of the properties at startup. Any ideas on how can I access the terrain shader properties through script?
Thanks in advance!
Answer by enigmabfd · Oct 24, 2014 at 02:19 PM
Hey Landern,
sadly, renderer.material and materialTemplate throw null-reference errors.
After a lot of trial and error I found a solution by following this workflow:
Created a new material and assigned it my custom shader.
Assigned the material at the terrain settings.
Placed a link (public Material ...;) in my script and assigned it the material through the Editor.
After that I managed to use SetTexture(...) successfully!
Thanks for your answer. :)
Answer by Landern · Oct 24, 2014 at 01:21 PM
Through the material, by a method property type(GetInt, GetFloat, etc), please reference the material documentation for available methods including setter methods.