文档

Unity Engine

Unity Engine

GetPassKeywords

Gets the local shader keywords that are valid for a pass within a particular shader.
阅读时间2 分钟最后更新于 16 天前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

GetPassKeywords(Shader, PassIdentifier)

Gets the local shader keywords that are valid for a pass within a particular shader.
public static LocalKeyword[] GetPassKeywords(Shader s, in PassIdentifier passIdentifier)

Parameters

The shader the pass belongs to.

passIdentifier

The identifier of a pass within the given shader.

Returns

Type

Description

LocalKeyword[]Returns an array of LocalKeywords that are valid for the pass you identify. If the PassIdentifier you use is invalid, this function returns an empty array and Unity displays an error in the Console window.

Remarks

Additional Resources: Pass.

GetPassKeywords(Shader, PassIdentifier, ShaderType)

Gets the local shader keywords that are valid for a specified shader stage of a pass within a particular shader.
public static LocalKeyword[] GetPassKeywords(Shader s, in PassIdentifier passIdentifier, ShaderType shaderType)

Parameters

The shader the pass belongs to.

passIdentifier

The identifier of a pass within the given shader.

shaderType

The shader stage of the given pass.

Returns

Type

Description

LocalKeyword[]Returns an array of LocalKeywords that are valid for the given shader stage of the pass you identify. If the PassIdentifier you use is invalid, this function returns an empty array and Unity displays an error in the Console window. If the shader stage doesn't exist in the pass, this function returns an empty array.

Remarks

Additional Resources: Pass, ShaderType.

GetPassKeywords(Shader, PassIdentifier, ShaderType, ShaderCompilerPlatform)

Gets the local shader keywords that are valid for a specified shader stage of a pass within a particular shader, for a given shader compiler platform.
public static LocalKeyword[] GetPassKeywords(Shader s, in PassIdentifier passIdentifier, ShaderType shaderType, ShaderCompilerPlatform shaderCompilerPlatform)

Parameters

The shader the pass belongs to.

passIdentifier

The identifier of a pass within the given shader.

shaderType

The shader stage of the given pass.

shaderCompilerPlatform

The shader compiler platform to check against.

Returns

Type

Description

LocalKeyword[]An array of LocalKeywords that are valid for the given shader stage of the pass you identify, for the given shader compiler platform. If the PassIdentifier you use is invalid, this function returns an empty array and Unity displays an error in the Console window. If the shader stage doesn't exist in the pass, this function returns an empty array.

Remarks

Some shader compiler platforms combine several shader stages in one. This method overload ensures that correct data is returned for all shader compiler platforms.
Additional Resources: Pass, ShaderType.