Class WebTask<T>
Represents an asynchronous operation, for single-threaded environments, that can return a value.
Inherited Members
Namespace: Meta.InstantGames .Runtime
Assembly: Unity.Meta.InstantGames.Sdk.dll
Syntax
public class WebTask<T>
Type Parameters
Name | Description |
---|---|
T | The type of the result produced by this task. |
Constructors
WebTask()
Initializes a new task.
Declaration
public WebTask()
Properties
Exception
The exception that caused the task to end prematurely. If the task completed successfully or has not yet thrown any exceptions, this will be null.
Declaration
public Exception Exception { get; }
Property Value
Type | Description |
---|---|
Exception |
IsCompleted
Indicates whether the task has completed.
Declaration
public bool IsCompleted { get; }
Property Value
Type | Description |
---|---|
bool |
IsFaulted
Indicates whether the task completed due to an unhandled exception.
Declaration
public bool IsFaulted { get; }
Property Value
Type | Description |
---|---|
bool |
Result
The result of the asynchronous task.
Declaration
public T Result { get; }
Property Value
Type | Description |
---|---|
T |
Methods
ContinueWith(Action<WebTask<T>>)
Creates a continuation that executes asynchronously when the target task completes.
Declaration
public WebTask<T> ContinueWith(Action<WebTask<T>> action)
Parameters
Type | Name | Description |
---|---|---|
Action<Web |
action | An action to run when the task completes. When run, the delegate will be passed the completed task as an argument. |
Returns
Type | Description |
---|---|
Web |
A new continuation task. |
GetAwaiter()
Gets an awaiter used to await this task. Required member to make the task awaitable. This API supports the product infrastructure and is not intended to be used directly from your code.
Declaration
public WebTaskAwaiter<T> GetAwaiter()
Returns
Type | Description |
---|---|
Web |
An awaiter instance. |
WaitForCompletion()
Waits for the task to complete execution. The method is intended to support compatibility with Unity coroutines.
Declaration
public IEnumerator WaitForCompletion()
Returns
Type | Description |
---|---|
IEnumerator | An enumerator that is iterable until the task completes, at which point iteration will stop. |