LocalKeywordSpace
Represents the local keyword space of a Shader or ComputeShader.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Struct
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<LocalKeywordSpace>
public readonly struct LocalKeywordSpace : IEquatable<LocalKeywordSpace>
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.
When you declare a shader keyword in the source file for a Shader or ComputeShader, Unity represents the keyword with a LocalKeyword and stores it in a .
LocalKeywordSpace- All keywords declared in the source file. For more information, see Declaring shader keywords.
- All keywords declared in dependencies of that source file. This comprises all Shaders that are included via the Fallback command, and all keywords declared in all Passes that are included via the UsePass command.
- All keywords that Unity adds automatically. For more information, see Unity's predefined shader keywords.
For a ComputeShader, access the with ComputeShader.keywordSpace. It contains all keywords declared in the source file. For more information, see Declaring shader keywords.
LocalKeywordSpaceAdditional Resources: Shader variants and keywords, LocalKeyword, GlobalKeyword, ComputeShader.keywordSpace, Shader.keywordSpace.
Properties
Property | Description |
|---|---|
| keywordCount | The number of local shader keywords in this local keyword space. (Read Only) |
| keywordNames | An array containing the names of all local shader keywords in this local keyword space. (Read Only) |
| keywords | An array containing all LocalKeyword structs in this local keyword space. (Read Only) |
Methods
Method | Description |
|---|---|
| FindKeyword | Searches for a local shader keyword with a given name in the keyword space. |
Operators
Operator | Description |
|---|---|
| operator == | Returns true if the local shader keyword spaces are the same. Otherwise, returns false. |
| operator != | Returns true if the local shader keyword spaces are not the same. Otherwise, returns false. |