# Append(GraphicsStateCollection)

> Adds all new graphics states and shader variants from the given collection to this collection.

## Definition

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

```csharp
public bool Append(GraphicsStateCollection collection)
```

### Parameters

**** (\[GraphicsStateCollection]\(/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection)): GraphicsStateCollection to append to this collection.

### Returns

| Type                                                          | Description                                                                |
| ------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if the collection was successfully appended, false otherwise. |

### Remarks

`Append` can be commonly used to add states and variants from the [GraphicsStateCollection.cacheMissCollection](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/cachemisscollection.md) into this collection after tracing cache misses via [GraphicsStateCollection.WarmUp](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/warmup.md). `collection` must not be currently tracing.

```csharp
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Jobs;

public class AppendExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;
    public string filePath;

    void Start()
    {
        // Start prewarming without any job dependencies and trace any missing graphics states that get created after warmup
        JobHandle handle = graphicsStateCollection.WarmUp(new JobHandle(), true);
    }

    void OnDestroy()
    {
        graphicsStateCollection.cacheMissCollection.EndTrace();

        // Update the current collection to include any new graphics states and then save to file
        if (graphicsStateCollection.cacheMissCollection.totalGraphicsStateCount > 0)
        {
            graphicsStateCollection.Append(graphicsStateCollection.cacheMissCollection);
            graphicsStateCollection.SaveToFile(filePath);
        }
    }
}
```

Additional Resources: [GraphicsStateCollection.cacheMissCollection](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/cachemisscollection.md), [GraphicsStateCollection.isTracing](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/istracing.md).
