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

Base class for representing an asynchronous request. AsyncRequest is a bit like Task, but doesn't always execute on the main thread like Task in Unity. Another difference, is that several different lambda functors can operate on different parts of the data in parallel. Once all lambda functors have completed, the request is marked as complete.

Inheritance
object
AsyncRequest
AsyncRequest<T>
Inherited Members
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 abstract class AsyncRequest

Fields

_executionContext

The execution context that this request was started with.

Declaration
protected AsyncRequest.ExecutionContext _executionContext
Field Value
Type Description
AsyncRequest.ExecutionContext

_state

Property which holds whether or not the request has started and or has an error.

Declaration
protected AsyncRequest.State _state
Field Value
Type Description
AsyncRequest.State

Properties

_executionHandles

Handles for asynchronous requests. Type depends on the ExecutionContext used to execute the request. This will be either JobHandle[] or a CountdownEvent

Declaration
protected object _executionHandles { get; set; }
Property Value
Type Description
object

completed

Returns true if the request has completed.

Declaration
public bool completed { get; }
Property Value
Type Description
bool

defaultExecutionContext

Property specifying the default ExecutionContext to use when executing requests.

Declaration
public static AsyncRequest.ExecutionContext defaultExecutionContext { get; set; }
Property Value
Type Description
AsyncRequest.ExecutionContext

error

Returns true if the request has encountered an error.

Declaration
public bool error { get; set; }
Property Value
Type Description
bool

jobsInFlight

Declaration
public abstract int jobsInFlight { get; }
Property Value
Type Description
int

maxAsyncRequestFrameAge

Specifying a non zero value for this property will cause the the SDK to complete requests whenever a request is about to be older than this property value. This is useful when using native containers inside of requests that use a temp allocator, which has a 4 frame limit before being deallocated. This applies to asynchronous execution only, i.e. ThreadPool and JobSystem.

Declaration
public static int maxAsyncRequestFrameAge { get; set; }
Property Value
Type Description
int

maxJobSystemParallelism

When using the Unity Job System, jobs will chain after previous jobs in such a way as to only utilize maxJobSystemParallelism worker threads at any time. i.e. Setting this to 1 will result in jobs chaining back to back with no parallelism.

Declaration
public static int maxJobSystemParallelism { get; set; }
Property Value
Type Description
int

requestFrameAgeToAutoComplete

Similar to the above static property, this instanced version can also be set. If set, then this value will be used, otherise, if left at 0, then the static property value will be used instead.

Declaration
public int requestFrameAgeToAutoComplete { get; set; }
Property Value
Type Description
int

started

Returns true if the request has started.

Declaration
public bool started { get; set; }
Property Value
Type Description
bool

Methods

AllResultsAreCompleted()

Virtual method implemented by derived classes. Called to determine if all results are present and completed.

Declaration
protected virtual bool AllResultsAreCompleted()
Returns
Type Description
bool

AnyResultHasError()

Virtual method implemented by derived classes. Called to determine if any result had an error.

Declaration
protected virtual bool AnyResultHasError()
Returns
Type Description
bool

Complete()

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

Declaration
public virtual void Complete()

Reset()

Virtual method implemented by derived classes. Resets the request. Called when returning to the object pool.

Declaration
public virtual void Reset()
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