Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How can I pass arguments to a Terrain shader at runtime?

Discussion in 'Scripting' started by Jagwire, Jul 6, 2015.

  1. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    I'm trying to map one of the Unity Pro water shaders to an object with a Terrain component, but the water script seems to require a Renderer component so it can directly access the assigned material to pass parameters to the water shader. Does anyone know of a way to do this with Terrain components?
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    I believe the textures used in terrain components are held in the TerrainData.detailPrototypes and TerrainData.splatPrototypes... I don't see a way to get from them to the renderers though, just the materials.