Methods

Instance Methods

Abort

Aborts the UnityTask - will throw a ThreadAbortedException

C#
unityTask.Abort();

ContinueOnUIThread

Creates a continuation that executes synchronously on the UI thread when the target UnityTask completes

C#
unityTask.ContinueOnUIThread((r) => { // Update a gameobject });

ContinueWith

Creates a continuation that executes asynchronously when the target UnityTask completes

C#
unityTask.ContinueWith((r) => { // Return a value and or do some more work });

Start

Start the UnityTask

C#
unityTask.Start();

Wait

Blocks the current thread until the UnityTask completes

C#
unityTask.Wait();

Static Methods

Run

Creates and starts a new UnityTask that runs on a new thread

C#
UnityTask.Run(() => { // Do some work on a background thread });

RunOnUIThread

Creates and starts a new UnityTask that runs synchronously on the UI thread

C#
UnityTask.RunOnUIThread(() => { // Queue some work on the ui thread });

WaitAll

Blocks the current thread until all of the provided UnityTask objects have completed execution

C#
UnityTask.WaitAll(unityTask1, unityTask2);

WhenAll

Monitors the provided UnityTask objects and raises a callback on the UI thread when they have all completed

C#
UnityTask.WhenAll(() => { // Raised when unityTask1 and unityTask2 have completed }, unityTask1, unityTask2);