docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class WebTask<T>

    Represents an asynchronous operation, for single-threaded environments, that can return a value.

    Inheritance
    object
    WebTask<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Meta.InstantGames.Runtime
    Assembly: Unity.Meta.InstantGames.Runtime.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<WebTask<T>> 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
    WebTask<T>

    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
    WebTaskAwaiter<T>

    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.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)