docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AsyncRequest<T>

    Concrete AsyncRequest for specific type T.

    Inheritance
    object
    AsyncRequest
    AsyncRequest<T>
    Implements
    IDisposable
    Inherited Members
    AsyncRequest.defaultExecutionContext
    AsyncRequest.maxJobSystemParallelism
    AsyncRequest.maxAsyncRequestFrameAge
    AsyncRequest.requestFrameAgeToAutoComplete
    AsyncRequest.started
    AsyncRequest.error
    AsyncRequest.completed
    AsyncRequest._state
    AsyncRequest._executionContext
    AsyncRequest._executionHandles
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro
    Assembly: Unity.SimulationPro.Capture.dll
    Syntax
    public class AsyncRequest<T> : AsyncRequest, IDisposable
    Type Parameters
    Name Description
    T

    The type of the payload data carried by this request.

    Constructors

    AsyncRequest()

    Default constructor for AsyncRequest.

    Declaration
    public AsyncRequest()

    Properties

    data

    Returns a reference to the payload for this request.

    Declaration
    public ref T data { get; }
    Property Value
    Type Description
    T

    jobsInFlight

    Gets the number of lambda functor jobs currently executing for this request.

    Declaration
    public override int jobsInFlight { get; }
    Property Value
    Type Description
    int
    Overrides
    AsyncRequest.jobsInFlight

    results

    Array of asynchronous results.

    Declaration
    public AsyncRequest.Result[] results { get; }
    Property Value
    Type Description
    Result[]

    Methods

    AllResultsAreCompleted()

    All results are completed if...

    1. The request was started.
    2. There are no callbacks in flight.
    3. All results are marked completed.
    Declaration
    protected override bool AllResultsAreCompleted()
    Returns
    Type Description
    bool

    true if the request was started, no callbacks are in flight, and every result is marked completed; otherwise false.

    Overrides
    AsyncRequest.AllResultsAreCompleted()

    AnyResultHasError()

    Returns true if any of the results had an error.

    Declaration
    protected override bool AnyResultHasError()
    Returns
    Type Description
    bool

    true if any result has the error flag set; otherwise false.

    Overrides
    AsyncRequest.AnyResultHasError()

    Complete()

    Virtual method implemented by derived classes. Completes the request. Called when the request is older than allowed, forcing it to complete.

    Declaration
    public override void Complete()
    Overrides
    AsyncRequest.Complete()

    Dispose()

    Disposes the request. This will add the request back to the object pool.

    Declaration
    public void Dispose()

    DontCare(AsyncRequest<T>)

    You can use this method to complete a request without needing a lambda function. Passing null will likely cause work to be skipped, but passing this will do it and complete.

    Declaration
    public static AsyncRequest.Result DontCare(AsyncRequest<T> r)
    Parameters
    Type Name Description
    AsyncRequest<T> r

    Right-hand operand.

    Returns
    Type Description
    AsyncRequest.Result

    The result.

    Enqueue(Func<AsyncRequest<T>, Result>)

    Queues a unit of work that can be executed on start.

    Declaration
    public void Enqueue(Func<AsyncRequest<T>, AsyncRequest.Result> functor)
    Parameters
    Type Name Description
    Func<AsyncRequest<T>, AsyncRequest.Result> functor

    A callback that needs to be invoked

    Execute(ExecutionContext)

    Starts executing all the queued callback functions in the given execution context.

    Declaration
    public void Execute(AsyncRequest.ExecutionContext executionContext = ExecutionContext.None)
    Parameters
    Type Name Description
    AsyncRequest.ExecutionContext executionContext

    Execution context in which the functions needs to be invoked.

    ~AsyncRequest()

    Releases unmanaged resources by disposing the request and returning it to the object pool.

    Declaration
    protected ~AsyncRequest()

    Reset()

    Resets the request. Called when adding back to the object pool.

    Declaration
    public override void Reset()
    Overrides
    AsyncRequest.Reset()

    Start(Func<AsyncRequest<T>, Result>, ExecutionContext)

    Queues a callback that needs to be executed in the given execution context, and starts the request.

    Declaration
    [Obsolete("Start(Func<...>, ExecutionContext) is deprecated. Use Enqueue(Func<...>) + Execute(ExecutionContext) instead.")]
    public void Start(Func<AsyncRequest<T>, AsyncRequest.Result> functor = null, AsyncRequest.ExecutionContext executionContext = ExecutionContext.None)
    Parameters
    Type Name Description
    Func<AsyncRequest<T>, AsyncRequest.Result> functor

    A callback that needs to be invoked

    AsyncRequest.ExecutionContext executionContext

    Execution context in which the functor needs to be invoked. viz. Threadpool, EnoOfFrame or Immediate, etc.

    Operators

    operator +(AsyncRequest<T>, Func<AsyncRequest<T>, Result>)

    Operator overload for adding functors to the AsyncRequest queue.

    Declaration
    public static AsyncRequest<T> operator +(AsyncRequest<T> a, Func<AsyncRequest<T>, AsyncRequest.Result> b)
    Parameters
    Type Name Description
    AsyncRequest<T> a

    Current AsyncRequest

    Func<AsyncRequest<T>, AsyncRequest.Result> b

    Functor to be added

    Returns
    Type Description
    AsyncRequest<T>

    AsyncRequest with updated functors queue.

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2026 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)