# GraphicsStateCollection

> Collection of shader variants and associated graphics states.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine.Experimental.Rendering](/engine/6000.0/script-reference/unityengine/experimental/rendering.md)
* **Assembly:** UnityEngine.CoreModule
* **Inherits from:** [Object](/engine/6000.0/script-reference/unityengine/object.md)

```csharp
public sealed class GraphicsStateCollection : Object
```

## Remarks

Use graphics state collections to record shader variants and graphics states encountered at runtime and prewarm shader variants.

Each shader variant in the collection may have one or more associated graphics states. Each permutation of a shader variant and a graphics state will result in a single GPU representation of the shader being created by Unity.

## Examples

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

public class GraphicsStateCollectionTracing : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        graphicsStateCollection = new GraphicsStateCollection();
        graphicsStateCollection.BeginTrace();
    }

    void OnDestroy()
    {
        graphicsStateCollection.EndTrace();
    }
}
```

## Constructors

| Constructor                                                                                                                                                                    | Description                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| [GraphicsStateCollection()](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/ctor.md#graphicsstatecollection\(\))                    | Create a GraphicsTextureCollection populated with contents of a file, or empty. |
| [GraphicsStateCollection(System.String)](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/ctor.md#graphicsstatecollection\(string\)) | Create a GraphicsTextureCollection populated with contents of a file, or empty. |

## Properties

| Property                                                                                                                                         | Description                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| [completedWarmupCount](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/completedwarmupcount.md)       | The number of shader variant permutations that have been warmed up.                        |
| [graphicsDeviceType](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/graphicsdevicetype.md)           | The graphics device API type the collection is intended to be used with.                   |
| [isTracing](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/istracing.md)                             | Flag indicating if the collection is actively tracing shader variants and graphics states. |
| [isWarmedUp](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/iswarmedup.md)                           | Flag indicating if the collection is warmed up.                                            |
| [qualityLevelName](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/qualitylevelname.md)               | The quality level the collection is intended to be used with.                              |
| [runtimePlatform](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/runtimeplatform.md)                 | The platform that the collection is intended to be used with.                              |
| [totalGraphicsStateCount](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/totalgraphicsstatecount.md) | The total number of graphics states across all shader variants in the collection.          |
| [variantCount](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/variantcount.md)                       | The number of shader variants contained in this collection.                                |
| [version](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/version.md)                                 | The current version of the collection.                                                     |

## Methods

| Method                                                                                                                                                           | Description                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [AddGraphicsStateForVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/addgraphicsstateforvariant.md)           | Adds a new graphics state associated with a shader variant.                                |
| [AddVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/addvariant.md)                                           | Adds a new shader variant to the collection.                                               |
| [BeginTrace](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/begintrace.md)                                           | Start tracing shader variants and graphics states encountered at runtime.                  |
| [ClearVariants](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/clearvariants.md)                                     | Clears all shader variants and associated graphics states from collection.                 |
| [ContainsVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/containsvariant.md)                                 | Check if variant exists in collection.                                                     |
| [EndTrace](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/endtrace.md)                                               | Stop tracing shader variants and graphics states encountered at runtime.                   |
| [GetGraphicsStateCountForVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/getgraphicsstatecountforvariant.md) | Get the number of graphics states associated to a shader variant.                          |
| [GetGraphicsStatesForVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/getgraphicsstatesforvariant.md)         | Populate given list with graphics states associated with input shader variant.             |
| [GetVariants](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/getvariants.md)                                         | Populate given list with shader variants contained in collection.                          |
| [LoadFromFile](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/loadfromfile.md)                                       | Load the GraphicsStateCollection at the given path.                                        |
| [RemoveGraphicsStatesForVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/removegraphicsstatesforvariant.md)   | Remove all associated graphics states from a shader variant.                               |
| [RemoveVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/removevariant.md)                                     | Remove shader variant and associated graphics states from collection.                      |
| [SaveToFile](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/savetofile.md)                                           | Save GraphicsStateCollection to disk.                                                      |
| [SendToEditor](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/sendtoeditor.md)                                       | Send GraphicsStateCollection to the Editor using PlayerConnection.                         |
| [WarmUp](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/warmup.md)                                                   | Prewarms all shader variants in this collection using associated graphics states.          |
| [WarmUpProgressively](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/warmupprogressively.md)                         | Prewarms the given number of shader variant permutations using associated graphics states. |

## Structs

| Struct                                                                                                                                               | Description                                                                                                                                                                     |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [GraphicsStateCollection.GraphicsState](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/graphicsstate.md) | A graphics state identifies a specific rendering configuration.                                                                                                                 |
| [GraphicsStateCollection.ShaderVariant](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection/shadervariant.md) | Identifies a specific variant of a shader stored in a [GraphicsStateCollection](/engine/6000.0/script-reference/unityengine/experimental/rendering/graphicsstatecollection.md). |

## Inheritance

**Inherited Members:**

* [Object.GetInstanceID()](/engine/6000.0/script-reference/unityengine/object/getinstanceid.md)
* [Object.GetHashCode()](/engine/6000.0/script-reference/unityengine/object/gethashcode.md)
* [Object.InstantiateAsync\<T>(T)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Transform, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Transform, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, InstantiateParameters, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, InstantiateParameters, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.InstantiateAsync\<T>(T, int, ReadOnlySpan\<Vector3>, ReadOnlySpan\<Quaternion>, InstantiateParameters, CancellationToken)](/engine/6000.0/script-reference/unityengine/object/instantiateasync.md)
* [Object.Instantiate(Object, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion\))
* [Object.Instantiate(Object, Vector3, Quaternion, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object-vector3-quaternion-transform\))
* [Object.Instantiate(Object)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object\))
* [Object.Instantiate(Object, Scene)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object-scene\))
* [Object.Instantiate\<T>(T, InstantiateParameters)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, InstantiateParameters)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate(Object, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform\))
* [Object.Instantiate(Object, Transform, bool)](/engine/6000.0/script-reference/unityengine/object/instantiate.md#instantiate\(object-transform-bool\))
* [Object.Instantiate\<T>(T)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Vector3, Quaternion, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Instantiate\<T>(T, Transform, bool)](/engine/6000.0/script-reference/unityengine/object/instantiate.md)
* [Object.Destroy(Object, float)](/engine/6000.0/script-reference/unityengine/object/destroy.md)
* [Object.DestroyImmediate(Object, bool)](/engine/6000.0/script-reference/unityengine/object/destroyimmediate.md)
* [Object.FindObjectsByType(Type, FindObjectsSortMode)](/engine/6000.0/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectssortmode\))
* [Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)](/engine/6000.0/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytype\(type-findobjectsinactive-findobjectssortmode\))
* [Object.DontDestroyOnLoad(Object)](/engine/6000.0/script-reference/unityengine/object/dontdestroyonload.md)
* [Object.FindObjectsByType\<T>(FindObjectsSortMode)](/engine/6000.0/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectssortmode\))
* [Object.FindObjectsByType\<T>(FindObjectsInactive, FindObjectsSortMode)](/engine/6000.0/script-reference/unityengine/object/findobjectsbytype.md#findobjectsbytypet\(findobjectsinactive-findobjectssortmode\))
* [Object.FindFirstObjectByType\<T>()](/engine/6000.0/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytypet\(\))
* [Object.FindAnyObjectByType\<T>()](/engine/6000.0/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(\))
* [Object.FindFirstObjectByType\<T>(FindObjectsInactive)](/engine/6000.0/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytypet\(findobjectsinactive\))
* [Object.FindAnyObjectByType\<T>(FindObjectsInactive)](/engine/6000.0/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytypet\(findobjectsinactive\))
* [Object.FindFirstObjectByType(Type)](/engine/6000.0/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytype\(type\))
* [Object.FindAnyObjectByType(Type)](/engine/6000.0/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type\))
* [Object.FindFirstObjectByType(Type, FindObjectsInactive)](/engine/6000.0/script-reference/unityengine/object/findfirstobjectbytype.md#findfirstobjectbytype\(type-findobjectsinactive\))
* [Object.FindAnyObjectByType(Type, FindObjectsInactive)](/engine/6000.0/script-reference/unityengine/object/findanyobjectbytype.md#findanyobjectbytype\(type-findobjectsinactive\))
* [Object.ToString()](/engine/6000.0/script-reference/unityengine/object/tostring.md)
* [Object.name](/engine/6000.0/script-reference/unityengine/object/name.md)
* [Object.hideFlags](/engine/6000.0/script-reference/unityengine/object/hideflags.md)

### Operators

| Operator                                                                           | Description                                                             |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [operator ==](/engine/6000.0/script-reference/unityengine/object/op-equality.md)   | Compares two object references to see if they refer to the same object. |
| [bool](/engine/6000.0/script-reference/unityengine/object/op-implicit.md)          | Determines whether the object exists.                                   |
| [operator !=](/engine/6000.0/script-reference/unityengine/object/op-inequality.md) | Compares if two objects refer to a different object.                    |
