# cacheMissCollection

> A separate GraphicsStateCollection that stores shader variants and graphics states that were not in this collection during GraphicsStateCollection.WarmUp.

## Definition

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

```csharp
public GraphicsStateCollection cacheMissCollection { get; }
```

### Remarks

When a prewarming a graphics state collection does not appear to reduce load times as expected, one possibility is that some graphics states encountered during playthrough were not contained in the "warmed up" collection. The `cacheMissCollection` can be used to resolve this issue.

When the user calls [GraphicsStateCollection.WarmUp](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/warmup.md) with `traceCacheMisses` set to `true`, the `cacheMissCollection` is created, otherwise it is null by default. After warmup, any time a shader variant state permutation that does not exist in the current collection is used, it will be added to the cache miss collection. This collection can then operated on as with any other `GraphicsStateCollection`.

A common use pattern is to enable `traceCacheMisses` during [GraphicsStateCollection.WarmUp](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/warmup.md), then after tracing either save it out as a separate collection or immediately append it to the current collection.

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

public class CacheMissTracingExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;
    public string cacheMissFilePath;

    void Start()
    {
        // Start prewarming without any job dependencies and with traceCacheMisses enabled
        JobHandle handle = graphicsStateCollection.WarmUp(new JobHandle(), true);
    }

    void OnDestroy()
    {
        graphicsStateCollection.cacheMissCollection.EndTrace();
        graphicsStateCollection.cacheMissCollection.SaveToFile(cacheMissFilePath);
    }
}
```

Additional Resources: [GraphicsStateCollection.isTracingCacheMisses](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/istracingcachemisses.md), [GraphicsStateCollection.SaveToFile](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/savetofile.md), [GraphicsStateCollection.SendToEditor](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/sendtoeditor.md), [GraphicsStateCollection.Append](/engine/6000.7/script-reference/unityengine/rendering/graphicsstatecollection/append.md).
