Class AsyncOperationCache
This class allows for recycling IAsyncOperation object in order to reduce GC load.
Inheritance
System.Object
AsyncOperationCache
Namespace: UnityEngine.ResourceManagement.AsyncOperations
Syntax
public class AsyncOperationCache
Fields
Instance
The singleton AsyncOperationCache instance.
Declaration
public static readonly AsyncOperationCache Instance
Field Value
| Type | Description |
|---|---|
| AsyncOperationCache |
Methods
Acquire<TAsyncOperation>()
Acquire an IAsyncOperation.
Declaration
public TAsyncOperation Acquire<TAsyncOperation>()
where TAsyncOperation : IAsyncOperation, new()
Returns
| Type | Description |
|---|---|
| TAsyncOperation | An IAsyncOperation of type TAsyncOperation. |
Type Parameters
| Name | Description |
|---|---|
| TAsyncOperation | The type of IAsyncOperation to be returned. |
Clear()
Clear all cached IAsyncOperation object.
Declaration
public void Clear()
Release(IAsyncOperation)
Release a completed IAsyncOperation back into the cache. ResetStatus will be called on the operation before it is used again.
Declaration
public void Release(IAsyncOperation operation)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncOperation | operation | The operation to release. |