Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Hi, guys, how can i get the Stage-specific info of a shader keyword directly.

Discussion in 'Scripting' started by qilin598866753, Mar 5, 2023.

  1. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    As we know, when we define a set of shader keywords, we can specify the stage of it, eg.vertext, fragment. Currently I find the struct ShaderKeyword in C# code,but it doesn't have the stage info, except seach the text from the shader file, any body has better method? thank u.
     
  2. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    I get resolution!
    LocalKeyword localKeyword = new LocalKeyword(shader, keyword);
    if (ShaderUtil.PassHasKeyword(shader, snippet.pass, localKeyword, snippet.shaderType, platform))