Search Unity

Question Accessing the Material in a layer of HDRP/LayeredLit Shader from a script.

Discussion in 'High Definition Render Pipeline' started by Ryuuguu, Apr 26, 2022.

  1. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    391
    I want to access the Material in a layer of HDRP/LayeredLit Shader from a script. Specifically, I would like to change the Layer1 / Surface inputs / base map / color. I have looked through Materials documentation, and all my editor suggestions for fields and methods of material. I can't find anything about a layer.

    Edit: the answer is to set property "_BaseColor1" with
    Code (CSharp):
    1.  material.SetColor("_BaseColor1", Color.green);
     
    Last edited: Apr 27, 2022