ShaderKeyword
Initializes a new instance of the ShaderKeyword class from a shader global keyword name.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Constructor
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
ShaderKeyword(string)
Initializes a new instance of the ShaderKeyword class from a shader global keyword name.
public ShaderKeyword(string keywordName)
Parameters
The name of the keyword.
Remarks
If you call this function and a keyword with the name you pass in does not exist, Unity creates one with that name. To get all the global keywords that already exist, use Shader.globalKeywords.
Additional Resources: IPreprocessShaders.OnProcessShader, IPreprocessComputeShaders.OnProcessComputeShader.
ShaderKeyword(Shader, string)
Initializes a new instance of the ShaderKeyword class from a local shader keyword name.
public ShaderKeyword(Shader shader, string keywordName)
Parameters
Remarks
If the shader defines a local keyword with the given name, Unity creates a valid ShaderKeyword instance that represents the local keyword. Otherwise, Unity creates an invalid ShaderKeyword instance.
Additional Resources: OnProcessShader, ShaderKeyword.IsValid.
ShaderKeyword(ComputeShader, string)
Initializes a new instance of the ShaderKeyword class from a local shader keyword name, and the compute shader that defines that local keyword.
public ShaderKeyword(ComputeShader shader, string keywordName)
Parameters
The compute shader that declares the local keyword.
The name of the keyword.
Remarks
If the compute shader defines a local keyword with the given name, Unity creates a valid ShaderKeyword instance that represents the local keyword. Otherwise, Unity creates an invalid ShaderKeyword instance.
Additional Resources: IPreprocessComputeShaders.OnProcessComputeShader, ShaderKeyword.IsValid.