AddVariant
Adds a new shader variant to the collection.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
AddVariant(Shader, PassIdentifier, LocalKeyword[])
Adds a new shader variant to the collection.
public bool AddVariant(Shader shader, PassIdentifier passId, LocalKeyword[] keywords)
Parameters
Shader used in the variant.
PassIdentifier used in the variant.
LocalKeyword array of keywords used in the variant.
Returns
Type | Description |
|---|---|
| bool | True if a new variant was added, false otherwise. |
Remarks
If only the 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, unless explicitly provided via .
materialglobalKeywordsAdditional Resources: GraphicsStateCollection.AddVariants, GraphicsStateCollection.RemoveVariant, GraphicsStateCollection.ContainsVariant.
AddVariant(Material, PassIdentifier)
Adds a new shader variant to the collection.
public bool AddVariant(Material mat, PassIdentifier passId)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if a new variant was added, false otherwise. |
Remarks
If only the 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, unless explicitly provided via .
materialglobalKeywordsAdditional Resources: GraphicsStateCollection.AddVariants, GraphicsStateCollection.RemoveVariant, GraphicsStateCollection.ContainsVariant.
AddVariant(Material, PassIdentifier, GlobalKeyword[])
Adds a new shader variant to the collection.
public bool AddVariant(Material mat, PassIdentifier passId, GlobalKeyword[] globalKeywords)
Parameters
PassIdentifier used in the variant.
GlobalKeyword array of global keywords to use with the material's enabled keywords in the variant.
Returns
Type | Description |
|---|---|
| bool | True if a new variant was added, false otherwise. |
Remarks
If only the 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, unless explicitly provided via .
materialglobalKeywords