# NextFrameAsync(CancellationToken)

> Resumes execution on the next frame.

## Definition

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

```csharp
public static Awaitable NextFrameAsync(CancellationToken cancellationToken = default)
```

### Parameters

**** (\[CancellationToken]\(https\://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)): Optional cancellation token.

### Returns

| Type                                                                  | Description |
| --------------------------------------------------------------------- | ----------- |
| [Awaitable](/engine/6000.6/script-reference/unityengine/awaitable.md) |             |

### Remarks

**Note:** This method can only be called from the main thread and always completes on main thread.

### Examples

```csharp
async Awaitable SampleSchedulingJobsForNextFrame()
{
    // Wait until end of frame to avoid competing over resources with other Unity subsystems
    await Awaitable.EndOfFrameAsync();
    var jobHandle = ScheduleSomethingWithJobSystem();
    // Let the job execute while the next frame starts
    await Awaitable.NextFrameAsync();
    jobHandle.Complete();
    // Use results of computation
}

JobHandle ScheduleSomethingWithJobSystem()
{
    ...
}
```
