SetKeyword
Adds a command to set the state of a global or local shader keyword.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
SetKeyword(GlobalKeyword, bool)
Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(in GlobalKeyword keyword, bool value)
Parameters
The local or global shader keyword to set the state for.
The state to set the shader keyword state to.
Remarks
Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.
Additional Resources: Shader variants and keywords, CommandBuffer.DisableKeyword, CommandBuffer.EnableKeyword, GlobalKeyword, LocalKeyword, Shader.SetKeyword, Material.SetKeyword, ComputeShader.SetKeyword.
SetKeyword(Material, LocalKeyword, bool)
Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(Material material, in LocalKeyword keyword, bool value)
Parameters
The material for which to set the state of the local shader keyword.
The local or global shader keyword to set the state for.
The state to set the shader keyword state to.
Remarks
Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.
Additional Resources: Shader variants and keywords, CommandBuffer.DisableKeyword, CommandBuffer.EnableKeyword, GlobalKeyword, LocalKeyword, Shader.SetKeyword, Material.SetKeyword, ComputeShader.SetKeyword.
SetKeyword(ComputeShader, LocalKeyword, bool)
Adds a command to set the state of a global or local shader keyword.
public void SetKeyword(ComputeShader computeShader, in LocalKeyword keyword, bool value)
Parameters
The compute shader for which to set the state of the local shader keyword.
The local or global shader keyword to set the state for.
The state to set the shader keyword state to.
Remarks
Shader keywords determine which shader variants Unity uses. For information on working with local shader keywords and global shader keywords and how they interact, see Using shader keywords with C# scripts.
Additional Resources: Shader variants and keywords, CommandBuffer.DisableKeyword, CommandBuffer.EnableKeyword, GlobalKeyword, LocalKeyword, Shader.SetKeyword, Material.SetKeyword, ComputeShader.SetKeyword.