docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License
Show / Hide Table of Contents
    • AddCollectorMenuAttribute
  • Unity.Simulation
    • AggregatedSample
    • AggregationEvent
    • ArrayCast
    • ArrayUtilities
    • AsyncRequest
    • AsyncRequest.ExecutionContext
    • AsyncRequest.Result
    • AsyncRequest.State
    • AsyncRequest<T>
    • BaseDataConsumer<T>
    • BaseDataConsumer<T>.Uploadable
    • Category
    • ChunkedStream
    • ChunkedUnityLog
    • CollectorBase
    • CollectorBase.ConsumeCollectorReport
    • CollectorElement
    • CollectorsBaseEditor
    • CollectorsList
    • Configuration
    • Configuration.SimulationConfiguration
    • ContentType
    • ContinuousEvents
    • ContinuousEvents.EventCollectionDelegate
    • ContinuousEvents.EventDispatchDelegate
    • CoreProfilerUtils
    • CounterEvent
    • CounterEventData
    • DXChunkedStream
    • DXChunkedUnityLog
    • DXFile
    • DXFormat
    • DXManager
    • DXTimeLogger
    • DataCapturePaths
    • DirectoryNameComponent
    • Dispatcher
    • EventBase
    • ExecUtility
    • ExitPlaymode
    • ExtensionNameComponent
    • FileNameComponent
    • FileProducer
    • Format
    • FrameCountCondition
    • FrameLimit
    • FrameNumberNameComponent
    • ICondition
    • IDataProduced
    • IGlobalProfilerDataDispatcher
    • IgnoreCollectorAttribute
    • LabelNameComponent
    • LambdaJob
    • LambdaJob.DelegateType
    • Log
    • Log.Level
    • Manager
    • Manager.NotificationDelegate
    • Manager.TickDelegate
    • NameComponent
    • NameGenerator
    • Options
    • PackageImportTests
    • PathUtility
    • PerfStatsManager
    • PlayerResolution
    • PlayerResolutionSettings
    • ProfilerManager
    • ProfilerProperties
    • ProfilerReport
    • ProfilerSamplingEvent
    • ReportingUtils
    • Sample
    • SampleProfilerCollector
    • SequenceNameComponent
    • SequencedPathName
    • SignedURLDataConsumer
    • SimSecondsCondition
    • SimulationProfiler
    • SimulationProfilerBase
    • SimulationProfilerEditor
    • TestUtility
    • ThreadUtility
    • TimeLimit
    • TimeLogger
    • TimeScale
    • TimeScaleEditor
    • TimeUtility
    • Timer
    • TimerSource
    • TimestampNameComponent
    • WallSecondsCondition

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.Simulation
Assembly: Unity.Simulation.Core.dll
Syntax
public class AsyncRequest<T> : AsyncRequest, IDisposable
Type Parameters
Name Description
T

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

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
Overrides
AsyncRequest.AllResultsAreCompleted()

AnyResultHasError()

Returns true if any of the results had an error.

Declaration
protected override bool AnyResultHasError()
Returns
Type Description
bool
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
Returns
Type Description
AsyncRequest.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()

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