Google is committed to advancing racial equity for Black communities. See how.

GoogleARCore.AsyncTask

A class used for monitoring the status of an asynchronous task.

Summary

Helper methods for dealing with asynchronous tasks.

Details
Template Parameters
T
The resultant type of the task.

Properties

IsComplete
bool
Gets a value indicating whether the task is complete.
IsInitialized
static bool
Gets a value indicating whether the acync task is initialized.
Result
T
Gets the result of a completed task.

Public functions

ThenAction(Action< T > doAfterTaskComplete)
AsyncTask< T >
Performs an action (callback) in the first Unity Update() call after task completion.
WaitForCompletion()
CustomYieldInstruction
Returns a yield instruction that monitors this task for completion within a coroutine.

Public static functions

InitAsyncTask()
void
Initializes the async task.
OnUpdate()
void
An Update handler called each frame.
PerformActionInUpdate(Action action)
void
Queues an action to be performed on Unity thread in Update().
ResetAsyncTask()
void
Resets the async task.

Properties

IsComplete

bool IsComplete

Gets a value indicating whether the task is complete.

true if the task is complete, otherwise false.

IsInitialized

static bool IsInitialized

Gets a value indicating whether the acync task is initialized.

Result

T Result

Gets the result of a completed task.

The result of the completed task.

Public functions

ThenAction

AsyncTask< T > ThenAction(
  Action< T > doAfterTaskComplete
)

Performs an action (callback) in the first Unity Update() call after task completion.

Details
Parameters
doAfterTaskComplete
The action to invoke when task is complete. The result of the task will be passed as an argument to the action.
Returns
The invoking asynchronous task.

WaitForCompletion

CustomYieldInstruction WaitForCompletion()

Returns a yield instruction that monitors this task for completion within a coroutine.

Details
Returns
A yield instruction that monitors this task for completion.

Public static functions

InitAsyncTask

void InitAsyncTask()

Initializes the async task.

OnUpdate

void OnUpdate()

An Update handler called each frame.

PerformActionInUpdate

void PerformActionInUpdate(
  Action action
)

Queues an action to be performed on Unity thread in Update().

This method can be called by any thread.

Details
Parameters
action
The action to perform.

ResetAsyncTask

void ResetAsyncTask()

Resets the async task.