Search Unity

How to switch texture in runtime use HDRP?

Discussion in 'High Definition Render Pipeline' started by zxcvb7653, Dec 10, 2019.

  1. zxcvb7653

    zxcvb7653

    Joined:
    Nov 11, 2017
    Posts:
    24
    I am following this guide:
    https://docs.unity3d.com/ScriptReference/Material.SetTexture.html



    Code (CSharp):
    1. //Make sure to enable the Keywords
    2.                 renderer.material.EnableKeyword("_EMISSIVE_COLOR_MAP");
    3.        
    4.                 renderer.material.SetTexture("_EmissiveColorMap", m_offMap);
    5.                 Debug.Log("Switched Tex");
    This is the code I used but it doesn't seem to be switching the material texture.

    Any help would be great! :)
     
  2. zxcvb7653

    zxcvb7653

    Joined:
    Nov 11, 2017
    Posts:
    24
    Update: The code works, I have just set this up wrong in the inspector sorry!
     
    Olmi likes this.