docs.unity.cn
    Show / Hide Table of Contents

    Struct Deferred<TResult>

    Namespace: UnityEngine.Promise
    Syntax
    public struct Deferred<TResult> : IDisposable
    Type Parameters
    Name Description
    TResult

    Type of the result this deferred retrieves from its UnityEngine.Promise.Promise`1.

    Properties

    currentStep

    Gets the index of the current step of the promise.

    Declaration
    public int currentStep { get; }
    Property Value
    Type Description
    Int32

    error

    The exception that prevented the handled promise to be fulfilled if it has been rejected.

    Declaration
    public Exception error { get; }
    Property Value
    Type Description
    Exception

    isActive

    Tells whether the Deferred is still active or not. A Deferred is active if it is not released.

    Declaration
    public bool isActive { get; }
    Property Value
    Type Description
    Boolean

    isDone

    A flag to determine if the handled promise has been fulfilled or rejected.

    Declaration
    public bool isDone { get; }
    Property Value
    Type Description
    Boolean

    isFulfilled

    A flag to determine if the handled promise has been fulfilled.

    Declaration
    public bool isFulfilled { get; }
    Property Value
    Type Description
    Boolean

    result

    The result of the async operation if the handled promise could be fulfilled.

    Declaration
    public TResult result { get; }
    Property Value
    Type Description
    TResult

    totalSteps

    Gets the number of steps of the promise.

    Declaration
    public int totalSteps { get; }
    Property Value
    Type Description
    Int32

    Methods

    Dispose()

    Release the handled promise if it is still active.

    Declaration
    public void Dispose()

    GetProgression(out Int32, out Int32)

    Gets the progression of the promise.

    Declaration
    public void GetProgression(out int currentStep, out int totalSteps)
    Parameters
    Type Name Description
    Int32 currentStep

    The index of the current step the promise is at.

    Int32 totalSteps

    The number of steps of the promise.

    Release()

    Resets the handled promise in order to recycle it.

    Declaration
    public void Release()

    Wait()

    Returns an IEnumerator instance so it can be used in the context of a coroutine.

    Declaration
    public IEnumerator Wait()
    Returns
    Type Description
    IEnumerator

    An IEnumerator instance to use in a coroutine.

    Operators

    Implicit(Deferred<TResult> to Deferred)

    Implicitly converts the Deferred<TResult> into a classic Deferred. Useful if the only thing you need to know is whether or not the promise is fulfill or not (ignoring the result).

    Declaration
    public static implicit operator Deferred(Deferred<TResult> deferred)
    Parameters
    Type Name Description
    Deferred<TResult> deferred

    The Deferred<TResult> to convert.

    Returns
    Type Description
    Deferred

    A classic Deferred instance.

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