# WarmUp(JobHandle)

> Prewarms all shader variants in this collection using associated graphics states.

## Definition

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

```csharp
public JobHandle WarmUp(JobHandle dependency = default)
```

### Parameters

**** (\[JobHandle]\(/engine/6000.3/script-reference/unity/jobs/jobhandle)): Job to wait for.

### Returns

| Type                                                                 | Description               |
| -------------------------------------------------------------------- | ------------------------- |
| [JobHandle](/engine/6000.3/script-reference/unity/jobs/jobhandle.md) | Handle to prewarming job. |

### Remarks

This will result in the GPU representation of the stored shader variants being created. Full graphics state collection warmup is only supported when [SystemInfo.supportsParallelPSOCreation](/engine/6000.3/script-reference/unityengine/systeminfo/supportsparallelpsocreation.md) is true. Otherwise, behavior falls back to the legacy [ShaderVariantCollection.WarmUp](/engine/6000.3/script-reference/unityengine/shadervariantcollection/warmup.md).

The JobHandle returned by this method can be used to control if the creation of GPU representations occurs synchronously or asynchronously.

The example below will perform the warm up asynchronously.

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

public class WarmUpExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        JobHandle handle = graphicsStateCollection.WarmUp();
    }
}
```

Below is an example of how to wait on the completion of the job handle in order to perform operations synchronously.

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

public class WarmUpSynchronousExample : MonoBehaviour
{
    public GraphicsStateCollection graphicsStateCollection;

    void Start()
    {
        JobHandle handle = graphicsStateCollection.WarmUp();
        handle.Complete();
    }
}
```

Prewarming can also be linked to other jobs using the input dependency and returned JobHandle.

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

public class WarmUpSynchronousExample : MonoBehaviour
{
    struct PostWarmUpJob : IJob
    {
        public void Execute()
        {
            Debug.Log("WarmUp is complete");
        }
    }

    public GraphicsStateCollection graphicsStateCollection;
    public JobHandle inputJobHandle;

    void Start()
    {
        JobHandle handle = graphicsStateCollection.WarmUp(inputJobHandle);

        var job = new PostWarmUpJob();
        job.Schedule(handle);
    }
}
```

Additional Resources: [GraphicsStateCollection.WarmUpProgressively](/engine/6000.3/script-reference/unityengine/experimental/rendering/graphicsstatecollection/warmupprogressively.md), [GraphicsStateCollection.isWarmedUp](/engine/6000.3/script-reference/unityengine/experimental/rendering/graphicsstatecollection/iswarmedup.md), [ShaderVariantCollection.WarmUp](/engine/6000.3/script-reference/unityengine/shadervariantcollection/warmup.md).
