Version: 2022.3

LocalKeywordSpace

struct in UnityEngine.Rendering

切换到手册

描述

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: 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 LocalKeywordSpace with ComputeShader.keywordSpace. It contains all keywords declared in the source file. For more information, see Declaring shader keywords.

See Also: Shader variants and keywords, LocalKeyword, GlobalKeyword, ComputeShader.keywordSpace, Shader.keywordSpace.

变量

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)

公共函数

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

运算符

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.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961