Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ContainsVariant

Check if the specified ShaderVariantCollection.ShaderVariant exists in the collection.
Read time 2 minutesLast updated 10 days ago

Definition

ContainsVariant(Shader, PassIdentifier, LocalKeyword[])

Check if the specified ShaderVariantCollection.ShaderVariant exists in the collection.
public bool ContainsVariant(Shader shader, PassIdentifier passId, LocalKeyword[] keywords)

Parameters

shader

Shader used in the variant.

PassIdentifier used in the variant.

LocalKeyword array of keywords used in the variant.

Returns

Type

Description

boolTrue if variant exists in collection, false otherwise.

Remarks

If only the
material
is provided, then this function will check for a shader variant using the set of Material.enabledKeywords combined with the global shader keywords that are currently enabled in the active context, unless explicitly provided via
globalKeywords
.

ContainsVariant(Material, PassIdentifier)

Check if the specified ShaderVariantCollection.ShaderVariant exists in the collection.
public bool ContainsVariant(Material mat, PassIdentifier passId)

Parameters


PassIdentifier used in the variant.

Returns

Type

Description

boolTrue if variant exists in collection, false otherwise.

Remarks

If only the
material
is provided, then this function will check for a shader variant using the set of Material.enabledKeywords combined with the global shader keywords that are currently enabled in the active context, unless explicitly provided via
globalKeywords
.

ContainsVariant(Material, PassIdentifier, GlobalKeyword[])

Check if the specified ShaderVariantCollection.ShaderVariant exists in the collection.
public bool ContainsVariant(Material mat, PassIdentifier passId, GlobalKeyword[] globalKeywords)

Parameters


PassIdentifier used in the variant.

globalKeywords

GlobalKeyword array of global keywords used in the variant.

Returns

Type

Description

boolTrue if variant exists in collection, false otherwise.

Remarks

If only the
material
is provided, then this function will check for a shader variant using the set of Material.enabledKeywords combined with the global shader keywords that are currently enabled in the active context, unless explicitly provided via
globalKeywords
.