Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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