Changing how shaders work using keywords
Resources and techniques for writing shader code so it uses conditionals to do different things under different circumstances.
阅读时间1 分钟最后更新于 1 个月前
Resources and techniques for adding shader keywords, using them to create branches and shader variants, and toggling them in the Unity Editor or in a script.
Page | Description |
|---|---|
| Shader keywords workflow | Learn about defining shader keywords to create shaders that share some common code, but have different functionality when you enable or disable a keyword. |
| How Unity compiles branching shaders | Choose dynamic branching or shader variants. |
| Declare shader keywords | Use a |
| Make shader behavior conditional on keywords | Use an |
| Toggle shader keywords in the Editor | Add material properties for shader keywords. |
| Toggle shader keywords in a script | Check if a keyword is enabled or disabled, and enable and disable it. |
| Add built-in keyword sets | Use Unity shader directive shortcuts to create sets of shader keywords and variants. |