Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


EndOfFrameAsync(CancellationToken)

Resumes execution after all Unity subsystems have run for the current frame.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static Awaitable EndOfFrameAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken

Optional cancellation token used to signal cancellation.

Returns

Type

Description

Awaitable

Remarks

Note: This method can only be called from the main thread and always completes on main thread. Also, in Editor, this awaitable is incompatible with BatchMode and requires the game to be in play mode (in edit mode, it will never complete).

Examples

private async Awaitable DoSomethingAsync(){ Debug.Log("Before game systems got updated for current thread"); await Awaitable.EndOfFrameAsync(); Debug.Log("After game systems got updated for current thread");}