# GetGraphicsStatesForVariant

> Populate given list with graphics states associated with an input shader variant.

## Definition

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

## GetGraphicsStatesForVariant(Shader, PassIdentifier, LocalKeyword\[], List\<GraphicsState>)

Populate given list with graphics states associated with an input shader variant.

```csharp
public void GetGraphicsStatesForVariant(Shader shader, PassIdentifier passId, LocalKeyword[] keywords, List<GraphicsStateCollection.GraphicsState> results)
```

### 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.**** (\[List\<GraphicsState>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): [GraphicsStateCollection.GraphicsState](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/graphicsstate.md) list to populate.

### Remarks

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

public class GetGraphicsStatesExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        List<GraphicsStateCollection.ShaderVariant> variants = new List<GraphicsStateCollection.ShaderVariant>();
        graphicsStateCollection.GetVariants(variants);
        foreach (var variant in variants)
        {
            List<GraphicsStateCollection.GraphicsState> states = new List<GraphicsStateCollection.GraphicsState>();
            graphicsStateCollection.GetGraphicsStatesForVariant(variant, states);
        }
    }
}
```

Additional Resources: [GraphicsStateCollection.GetGraphicsStateCountForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/getgraphicsstatecountforvariant.md), [GraphicsStateCollection.AddGraphicsStateForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/addgraphicsstateforvariant.md).

## GetGraphicsStatesForVariant(ShaderVariant, List\<GraphicsState>)

Populate given list with graphics states associated with an input shader variant.

```csharp
public void GetGraphicsStatesForVariant(GraphicsStateCollection.ShaderVariant variant, List<GraphicsStateCollection.GraphicsState> results)
```

### Parameters

**** (\[ShaderVariant]\(/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/shadervariant)): The input shader variant.**** (\[List\<GraphicsState>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): [GraphicsStateCollection.GraphicsState](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/graphicsstate.md) list to populate.

### Remarks

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

public class GetGraphicsStatesExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        List<GraphicsStateCollection.ShaderVariant> variants = new List<GraphicsStateCollection.ShaderVariant>();
        graphicsStateCollection.GetVariants(variants);
        foreach (var variant in variants)
        {
            List<GraphicsStateCollection.GraphicsState> states = new List<GraphicsStateCollection.GraphicsState>();
            graphicsStateCollection.GetGraphicsStatesForVariant(variant, states);
        }
    }
}
```

Additional Resources: [GraphicsStateCollection.GetGraphicsStateCountForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/getgraphicsstatecountforvariant.md), [GraphicsStateCollection.AddGraphicsStateForVariant](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/addgraphicsstateforvariant.md).
