EnableKeyword
Adds a command to enable a global or local shader keyword.
Read time 2 minutesLast updated 5 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
EnableKeyword(GlobalKeyword)
Adds a command to enable a global or local shader keyword.
public void EnableKeyword(in GlobalKeyword keyword)
Parameters
The global or local shader keyword to enable.
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.SetKeyword, CommandBuffer.DisableKeyword, GlobalKeyword, LocalKeyword, Shader.DisableKeyword, Material.DisableKeyword, ComputeShader.DisableKeyword, RayTracingShader.DisableKeyword.
EnableKeyword(Material, LocalKeyword)
Adds a command to enable a global or local shader keyword.
public void EnableKeyword(Material material, in LocalKeyword keyword)
Parameters
The material on which to enable the local shader keyword.
The global or local shader keyword to enable.
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.SetKeyword, CommandBuffer.DisableKeyword, GlobalKeyword, LocalKeyword, Shader.DisableKeyword, Material.DisableKeyword, ComputeShader.DisableKeyword, RayTracingShader.DisableKeyword.
EnableKeyword(ComputeShader, LocalKeyword)
Adds a command to enable a global or local shader keyword.
public void EnableKeyword(ComputeShader computeShader, in LocalKeyword keyword)
Parameters
The compute shader for which to enable the local shader keyword.
The global or local shader keyword to enable.
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.SetKeyword, CommandBuffer.DisableKeyword, GlobalKeyword, LocalKeyword, Shader.DisableKeyword, Material.DisableKeyword, ComputeShader.DisableKeyword, RayTracingShader.DisableKeyword.
EnableKeyword(RayTracingShader, LocalKeyword)
Adds a command to enable a global or local shader keyword.
public void EnableKeyword(RayTracingShader rayTracingShader, in LocalKeyword keyword)
Parameters
The ray tracing shader for which to enable the local shader keyword.
The global or local shader keyword to enable.
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.SetKeyword, CommandBuffer.DisableKeyword, GlobalKeyword, LocalKeyword, Shader.DisableKeyword, Material.DisableKeyword, ComputeShader.DisableKeyword, RayTracingShader.DisableKeyword.