---
title: GetComputeVariants(List<ComputeShaderVariant>)
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/getcomputevariants
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/getcomputevariants.md
last_updated: 2026-11-13
generated_at: 2026-11-18T08:38:08.979Z
locale: en-us
---

# GetComputeVariants(List<ComputeShaderVariant>)

> Populates the given list with the compute shader variants in the collection.

## Definition

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

```csharp
public void GetComputeVariants(List<GraphicsStateCollection.ComputeShaderVariant> results)
```

### Parameters

**** (\[List\<ComputeShaderVariant>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): The [GraphicsStateCollection.ComputeShaderVariant](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/computeshadervariant.md) list to populate.

### Remarks

If Unity can't find the compute shader of a variant, it logs a warning and the returned [GraphicsStateCollection.ComputeShaderVariant](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/computeshadervariant.md) has a `null` `shader`, a `kernelIndex` of 0, and no `keywords`. The returned `keywords` of the other variants omit any keywords that [GraphicsStateCollection.AddComputeVariant](/engine/7000.0/script-reference/unityengine/rendering/graphicsstatecollection/addcomputevariant.md) ignores, so they can differ from the keywords you passed to it.

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

### Examples

```csharp
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

// Attach this script to a GameObject, then assign a graphics state collection in the Inspector.
public class GetComputeVariantsExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        List<GraphicsStateCollection.ComputeShaderVariant> variants = new List<GraphicsStateCollection.ComputeShaderVariant>();
        graphicsStateCollection.GetComputeVariants(variants);
        Debug.Log("Collection contains " + variants.Count + " compute shader variants.");
    }
}
```
