Version: 2022.3
LanguageEnglish
  • C#

LocalKeywordSpace

struct in UnityEngine.Rendering

/

Implemented in:UnityEngine.CoreModule

Suggest a change

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.

Close

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.

Close

Cancel

Description

Represents the local keyword space of a Shader or ComputeShader.

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.

For a Shader, access the LocalKeywordSpace with Shader.keywordSpace. It contains:

For a ComputeShader, access the LocalKeywordSpace with ComputeShader.keywordSpace. It contains all keywords declared in the source file. For more information, see Declaring shader keywords.

Additional resources: Shader variants and keywords, LocalKeyword, GlobalKeyword, ComputeShader.keywordSpace, Shader.keywordSpace.

Properties

keywordCountThe number of local shader keywords in this local keyword space. (Read Only)
keywordNamesAn array containing the names of all local shader keywords in this local keyword space. (Read Only)
keywordsAn array containing all LocalKeyword structs in this local keyword space. (Read Only)

Public Methods

FindKeywordSearches for a local shader keyword with a given name in the keyword space.

Operators

operator !=Returns true if the local shader keyword spaces are not the same. Otherwise, returns false.
operator ==Returns true if the local shader keyword spaces are the same. Otherwise, returns false.