---
title: RemoveComputeVariant(ComputeShader, int, LocalKeyword[])
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/removecomputevariant
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/removecomputevariant.md
last_updated: 2026-11-13
generated_at: 2026-11-18T08:37:53.953Z
locale: en-us
---

# RemoveComputeVariant(ComputeShader, int, LocalKeyword[])

> Removes the specified compute shader variant from the collection.

## Definition

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

```csharp
public bool RemoveComputeVariant(ComputeShader shader, int kernelIndex, LocalKeyword[] keywords)
```

### Parameters

**** (\[ComputeShader]\(/engine/7000.0/script-reference/unityengine/computeshader)): The [ComputeShader](/engine/7000.0/script-reference/unityengine/computeshader.md) of the variant.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index of the kernel in `shader`.**** (\[LocalKeyword\[]]\(/engine/7000.0/script-reference/unityengine/rendering/localkeyword)): The [LocalKeyword](/engine/7000.0/script-reference/unityengine/rendering/localkeyword.md) array of the variant. The order of the keywords doesn't matter. Unity ignores keywords that the kernel doesn't declare and keywords that only select a dynamic branch.

### Returns

| Type                                                          | Description                                                              |
| ------------------------------------------------------------- | ------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns `true` if Unity removes the variant. Otherwise, returns `false`. |

### Remarks

Returns `false` if `shader` is `null` or the variant isn't in the collection. If you remove a variant that Unity already warmed up, [GraphicsStateCollection.completedWarmupCount](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/completedwarmupcount.md) decreases.

Additional Resources: [GraphicsStateCollection.AddComputeVariant](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/addcomputevariant.md), [GraphicsStateCollection.ContainsComputeVariant](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/containscomputevariant.md).

### Examples

```csharp
using UnityEngine;
using UnityEngine.Rendering;

// Attach this script to a GameObject, then assign a graphics state collection and a compute shader in the Inspector.
public class RemoveComputeVariantExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;
    public ComputeShader computeShader;

    void Start()
    {
        // Uses the CSMain kernel with the keywords currently enabled on the compute shader.
        int kernelIndex = computeShader.FindKernel("CSMain");
        bool removed = graphicsStateCollection.RemoveComputeVariant(computeShader, kernelIndex, computeShader.enabledKeywords);
        Debug.Log(removed ? "Removed the compute shader variant." : "The compute shader variant isn't in the collection.");
    }
}
```
