# RemoveVariant

> Remove ShaderVariantCollection.ShaderVariant and associated graphics states from collection.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering](/engine/6000.7/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

## RemoveVariant(Shader, PassIdentifier, LocalKeyword\[])

Remove [ShaderVariantCollection.ShaderVariant](/engine/6000.7/script-reference/unityengine/shadervariantcollection/shadervariant.md) and associated graphics states from collection.

```csharp
public bool RemoveVariant(Shader shader, PassIdentifier passId, LocalKeyword[] keywords)
```

### Parameters

**** (\[Shader]\(/engine/6000.7/script-reference/unityengine/shader)): Shader used in the variant.**** (\[PassIdentifier]\(/engine/6000.7/script-reference/unityengine/rendering/passidentifier)): PassIdentifier used in the variant.**** (\[LocalKeyword\[]]\(/engine/6000.7/script-reference/unityengine/rendering/localkeyword)): [LocalKeyword](/engine/6000.7/script-reference/unityengine/rendering/localkeyword.md) array of keywords used in the variant.

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if successfully removed, false otherwise. |

### Remarks

If only the `material` is provided, then this function will only remove a shader variant matching exactly the set of [Material.enabledKeywords](/engine/6000.7/script-reference/unityengine/material/enabledkeywords.md) combined with the global shader keywords that are **currently enabled** in the active context, unless they are explicitly provided via `globalKeywords`.

Additional Resources: [GraphicsStateCollection.RemoveGraphicsStatesForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/removegraphicsstatesforvariant.md), [GraphicsStateCollection.ContainsVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/containsvariant.md).

## RemoveVariant(Material, PassIdentifier)

Remove [ShaderVariantCollection.ShaderVariant](/engine/6000.7/script-reference/unityengine/shadervariantcollection/shadervariant.md) and associated graphics states from collection.

```csharp
public bool RemoveVariant(Material mat, PassIdentifier passId)
```

### Parameters

**** (\[Material]\(/engine/6000.7/script-reference/unityengine/material)): **** (\[PassIdentifier]\(/engine/6000.7/script-reference/unityengine/rendering/passidentifier)): PassIdentifier used in the variant.

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if successfully removed, false otherwise. |

### Remarks

If only the `material` is provided, then this function will only remove a shader variant matching exactly the set of [Material.enabledKeywords](/engine/6000.7/script-reference/unityengine/material/enabledkeywords.md) combined with the global shader keywords that are **currently enabled** in the active context, unless they are explicitly provided via `globalKeywords`.

Additional Resources: [GraphicsStateCollection.RemoveGraphicsStatesForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/removegraphicsstatesforvariant.md), [GraphicsStateCollection.ContainsVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/containsvariant.md).

## RemoveVariant(Material, PassIdentifier, GlobalKeyword\[])

Remove [ShaderVariantCollection.ShaderVariant](/engine/6000.7/script-reference/unityengine/shadervariantcollection/shadervariant.md) and associated graphics states from collection.

```csharp
public bool RemoveVariant(Material mat, PassIdentifier passId, GlobalKeyword[] globalKeywords)
```

### Parameters

**** (\[Material]\(/engine/6000.7/script-reference/unityengine/material)): **** (\[PassIdentifier]\(/engine/6000.7/script-reference/unityengine/rendering/passidentifier)): PassIdentifier used in the variant.**** (\[GlobalKeyword\[]]\(/engine/6000.7/script-reference/unityengine/rendering/globalkeyword)): [GlobalKeyword](/engine/6000.7/script-reference/unityengine/rendering/globalkeyword.md) array of global keywords used in the variant.

### Returns

| Type                                                          | Description                                    |
| ------------------------------------------------------------- | ---------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if successfully removed, false otherwise. |

### Remarks

If only the `material` is provided, then this function will only remove a shader variant matching exactly the set of [Material.enabledKeywords](/engine/6000.7/script-reference/unityengine/material/enabledkeywords.md) combined with the global shader keywords that are **currently enabled** in the active context, unless they are explicitly provided via `globalKeywords`.

Additional Resources: [GraphicsStateCollection.RemoveGraphicsStatesForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/removegraphicsstatesforvariant.md), [GraphicsStateCollection.ContainsVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/containsvariant.md).
