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.

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))