Search Unity

Retrieve Shader Keywords

Discussion in 'Shaders' started by Justafin, May 15, 2013.

  1. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    I have a shader set up with keywords and am using the new custom material editor feature to toggle these keywords on/off on a per material basis. The problem I'm having is writing a script that will make an instance of the material and copy over the current material's active keywords. I thought I could access them by just reading in renderer.material.shaderKeywords but that always seems to be empty. Any ideas?

    Thanks,

    Justin
     
  2. Justafin

    Justafin

    Joined:
    Aug 6, 2012
    Posts:
    30
    Nevermind. Silly me, I forgot to grab sharedMaterial.shaderKeywords :/
     
    Last edited: May 15, 2013