docs.unity.cn
    Show / Hide Table of Contents

    Struct Completer<TResult>

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

    Type of the result this completer can accept in its Resolve(TResult) method.

    Properties

    isActive

    Tells whether this Completer is active or not. A Completer is active while its Deferred is not released.

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

    None

    Handle to settle a promise.

    Declaration
    public static Completer<TResult> None { get; }
    Property Value
    Type Description
    Completer<TResult>

    Methods

    Reject(Exception)

    Rejects the handled promise for the given reason.

    Declaration
    public void Reject(Exception reason)
    Parameters
    Type Name Description
    Exception reason

    The exception that prevented the handled promise to be fulfilled.

    Resolve(TResult)

    Fulfills the handled promise with the given data.

    Declaration
    public void Resolve(TResult value)
    Parameters
    Type Name Description
    TResult value

    The promised data.

    SetProgression(Int32, Int32)

    Sets the progression of the promise.

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

    The index of the current step the promise is at.

    Int32 totalSteps

    The total number of steps of the promise.

    Operators

    Implicit(Completer<TResult> to Rejectable)

    Converts the completer into a Rejectable so it can be used easily in validation processes where only Reject(Exception) is necessary.

    Declaration
    public static implicit operator Rejectable(Completer<TResult> completer)
    Parameters
    Type Name Description
    Completer<TResult> completer

    The completer to convert.

    Returns
    Type Description
    Rejectable

    The Rejectable for the given completer.

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