Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddVariant

Adds a new shader variant to the collection.
Read time 1 minuteLast updated 11 days ago

Definition

AddVariant(Shader, PassIdentifier, LocalKeyword[])

Adds a new shader variant to the collection.
public bool AddVariant(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 a new variant was added, false otherwise.

Remarks

If only the
material
is provided, then the generated ShaderVariantCollection.ShaderVariant will use the set of Material.enabledKeywords combined with the global shader keywords that are currently enabled in the active context.

AddVariant(Material, PassIdentifier)

Adds a new shader variant to the collection.
public bool AddVariant(Material mat, PassIdentifier passId)

Parameters


PassIdentifier used in the variant.

Returns

Type

Description

boolTrue if a new variant was added, false otherwise.

Remarks

If only the
material
is provided, then the generated ShaderVariantCollection.ShaderVariant will use the set of Material.enabledKeywords combined with the global shader keywords that are currently enabled in the active context.