Struct AsyncOperationHandle
Non typed operation handle. This allows for reference counting and checking for valid references.
Namespace: UnityEngine.ResourceManagement.AsyncOperations
Syntax
public struct AsyncOperationHandle : IEnumerator
Properties
DebugName
Debug name of the operation.
Declaration
public string DebugName { get; }
Property Value
Type | Description |
---|---|
System.String |
IsDone
True if the operation is complete.
Declaration
public bool IsDone { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OperationException
The exception for a failed operation. This will be null unless Status is failed.
Declaration
public Exception OperationException { get; }
Property Value
Type | Description |
---|---|
System.Exception |
PercentComplete
The progress of the internal operation.
Declaration
public float PercentComplete { get; }
Property Value
Type | Description |
---|---|
System.Single |
Result
The result object of the operations.
Declaration
public object Result { get; }
Property Value
Type | Description |
---|---|
System.Object |
Status
The status of the internal operation.
Declaration
public AsyncOperationStatus Status { get; }
Property Value
Type | Description |
---|---|
AsyncOperationStatus |
Task
Return a Task object to wait on when using async await.
Declaration
public Task<object> Task { get; }
Property Value
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> |
Methods
Convert<T>()
Converts handle to be typed. This does not increment the reference count.
Declaration
public AsyncOperationHandle<T> Convert<T>()
Returns
Type | Description |
---|---|
AsyncOperationHandle<T> | A new handle that is typed. |
Type Parameters
Name | Description |
---|---|
T | The type of the handle. |
GetDependencies(List<AsyncOperationHandle>)
Get dependency operations.
Declaration
public void GetDependencies(List<AsyncOperationHandle> deps)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AsyncOperationHandle> | deps |
IsValid()
Check if the internal operation is not null and has the same version of this handle.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
System.Boolean | True if valid. |
Events
Completed
Completion event for the internal operation. If this is assigned on a completed operation, the callback is deferred until the LateUpdate of the current frame.
Declaration
public event Action<AsyncOperationHandle> Completed
Event Type
Type | Description |
---|---|
System.Action<AsyncOperationHandle> |
Destroyed
Event for handling the destruction of the operation.
Declaration
public event Action<AsyncOperationHandle> Destroyed
Event Type
Type | Description |
---|---|
System.Action<AsyncOperationHandle> |