docs.unity.cn
    Show / Hide Table of Contents

    Class Promises

    A UnityEngine.Promise.Promise pool manager.

    Inheritance
    Object
    Promises
    Namespace: UnityEngine.Promise
    Syntax
    public static class Promises

    Methods

    GetHandles(out Deferred, out Completer)

    Take a promise out of the pool, or create one if it is empty, and set the two given handlers to handle this promise.

    Declaration
    public static void GetHandles(out Deferred deferred, out Completer completer)
    Parameters
    Type Name Description
    Deferred deferred

    A handler to read data from the taken promise.

    Completer completer

    A handler to write data to the taken promise.

    GetHandles<TResult>(out Deferred<TResult>, out Completer<TResult>)

    Extract a promise from the pool, or create one if it is empty, and set the two given handlers to handle this promise.

    Declaration
    public static void GetHandles<TResult>(out Deferred<TResult> deferred, out Completer<TResult> completer)
    Parameters
    Type Name Description
    Deferred<TResult> deferred

    A handler to read data from the taken promise.

    Completer<TResult> completer

    A handler to write data to the taken promise.

    Type Parameters
    Name Description
    TResult

    Type of the result of the promise.

    Wait(IEnumerable<Deferred>, Boolean)

    Waits for a list of deferred to be done.

    Declaration
    public static Deferred Wait(IEnumerable<Deferred> deferreds, bool tolerant = true)
    Parameters
    Type Name Description
    IEnumerable<Deferred> deferreds

    The list of deferred to wait for.

    Boolean tolerant

    It true, the returned deferred is fulfilled even if some deferred from the list are rejected. Otherwise, one rejection will also reject the returned deferred. In this case, the errors from all the rejected deferred are associated in an AggregateException.

    Returns
    Type Description
    Deferred

    A single deferred, done when the given list of deferred are done.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 16 June 2021