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!

Through the material, by a method property type(GetInt, GetFloat, etc), please reference the material documentation for available methods including setter methods.

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:

  1. Created a new material and assigned it my custom shader.
  2. Assigned the material at the terrain settings.
  3. Placed a link (public Material …:wink: in my script and assigned it the material through the Editor.

After that I managed to use SetTexture(…) successfully!

Thanks for your answer. :slight_smile: