Unity - Scripting API: LocalKeyword
struct in UnityEngine.Rendering
/
Implemented in:UnityEngine.CoreModule
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Description
Represents a shader keyword declared in a shader source file.
- To set the state of a local shader keyword, use Material.SetKeyword, Material.EnableKeyword, or Material.DisableKeyword.
- To check the state of a local shader keyword, use Material.IsKeywordEnabled or Material.enabledKeywords.
- To access the
LocalKeywordSpace, use Material.shader to access the Shader that the material uses, and then use Shader.keywordSpace.
For a ComputeShader:
- To set the state of a local shader keyword, use ComputeShader.SetKeyword, ComputeShader.EnableKeyword, or ComputeShader.DisableKeyword.
- To check the state of a local shader keyword, use ComputeShader.IsKeywordEnabled or ComputeShader.enabledKeywords.
- To access the
LocalKeywordSpace, use ComputeShader.keywordSpace.
For a RayTracingShader:
- To set the state of a local shader keyword, use RayTracingShader.SetKeyword, RayTracingShader.EnableKeyword, or RayTracingShader.DisableKeyword.
- To check the state of a local shader keyword, use RayTracingShader.IsKeywordEnabled or RayTracingShader.enabledKeywords.
- To access the
LocalKeywordSpace, use RayTracingShader.keywordSpace.
Properties
| Property | Description |
|---|---|
| isDynamic | Specifies whether this local shader keyword is used for dynamic branching (Read Only). |
| isOverridable | Whether this local shader keyword can be overridden by a global shader keyword. (Read Only). |
| isValid | Specifies whether this local shader keyword is valid (Read Only). |
| name | The name of the shader keyword (Read Only). |
| type | The type of the shader keyword (Read Only). |
Constructors
| Constructor | Description |
|---|---|
| LocalKeyword | Initializes and returns a LocalKeyword struct that represents an existing local shader keyword for a given Shader. |
Operators
| Operator | Description |
|---|---|
| operator != | Returns true if the shader keywords are not the same. Otherwise, returns false. |
| operator == | Returns true if the shader keywords are the same. Otherwise, returns false. |