Class AsyncOperationBase<TObject>
base class for implemented AsyncOperations, implements the needed interfaces and consolidates redundant code
Inheritance
Namespace: UnityEngine.ResourceManagement.AsyncOperations
Syntax
public abstract class AsyncOperationBase<TObject> : IAsyncOperation<TObject>, IAsyncOperation, IEnumerator
Type Parameters
Name | Description |
---|---|
TObject |
Constructors
AsyncOperationBase()
Constructor.
Declaration
protected AsyncOperationBase()
Fields
m_Context
Context object. This is usually set to the IResourceLocation used to start this operation.
Declaration
protected object m_Context
Field Value
Type | Description |
---|---|
System.Object |
m_Error
If and error is encountered, an exception is saved in this member.
Declaration
protected Exception m_Error
Field Value
Type | Description |
---|---|
System.Exception |
m_Key
The key used to start the operation. This is usually the address.
Declaration
protected object m_Key
Field Value
Type | Description |
---|---|
System.Object |
m_ReleaseToCacheOnCompletion
If true, this operation is released to a cache for re-use. Otherwise, it will be garbage collected.
Declaration
protected bool m_ReleaseToCacheOnCompletion
Field Value
Type | Description |
---|---|
System.Boolean |
m_Result
The result value of the operation.
Declaration
protected TObject m_Result
Field Value
Type | Description |
---|---|
TObject |
m_Status
The status of the operation.
Declaration
protected AsyncOperationStatus m_Status
Field Value
Type | Description |
---|---|
AsyncOperationStatus |
Properties
Context
Gets the context object related to this operation, usually set to the IResourceLocation.
Declaration
public object Context { get; protected set; }
Property Value
Type | Description |
---|---|
System.Object | The context object. |
Implements
Current
Declaration
public object Current { get; }
Property Value
Type | Description |
---|---|
System.Object |
IsDone
Gets a value indicating whether this ResourceManagement.IAsyncOperation is done.
Declaration
public virtual bool IsDone { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Implements
IsValid
used by Validate to ensure operation is in correct state
Declaration
public bool IsValid { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
Key
Gets the key related to this operation, usually set to the address.
Declaration
public virtual object Key { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The context object. |
Implements
OperationException
Gets the exception that caused this operation to change its status to Failure.
Declaration
public Exception OperationException { get; protected set; }
Property Value
Type | Description |
---|---|
System.Exception | The exception. |
Implements
PercentComplete
Gets the percent complete of this operation.
Declaration
public virtual float PercentComplete { get; }
Property Value
Type | Description |
---|---|
System.Single | The percent complete. |
Implements
Result
Declaration
public TObject Result { get; }
Property Value
Type | Description |
---|---|
TObject |
Implements
Status
returns the status of the operation
Declaration
public AsyncOperationStatus Status { get; protected set; }
Property Value
Type | Description |
---|---|
AsyncOperationStatus | Enum indicating success or failure of the operation. |
Implements
WaitHandle
Declaration
public WaitHandle WaitHandle { get; }
Property Value
Type | Description |
---|---|
System.Threading.WaitHandle |
Implements
Methods
InvokeCompletionEvent()
Call the event handlers for this operation.
Declaration
public void InvokeCompletionEvent()
MoveNext()
Declaration
public bool MoveNext()
Returns
Type | Description |
---|---|
System.Boolean |
Release()
Release operation back to internal cache. This can be used to avoid garbage collection.
Declaration
public virtual void Release()
Implements
Reset()
Declaration
public void Reset()
ResetStatus()
Reset status and error
Declaration
public virtual void ResetStatus()
Implements
Retain()
Declaration
public IAsyncOperation<TObject> Retain()
Returns
Type | Description |
---|---|
IAsyncOperation<TObject> |
Implements
SetResult(TObject)
Set the result object. Status will be set to AsyncOperationStatus.Succeeded if the value is non-null, otherwise it is set to AsyncOperationStatus.Failed.
Declaration
public virtual void SetResult(TObject result)
Parameters
Type | Name | Description |
---|---|---|
TObject | result | The value to set result to. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Validate()
internal integrity check
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
System.Boolean |
Implements
Events
Completed
Declaration
public event Action<IAsyncOperation<TObject>> Completed
Event Type
Type | Description |
---|---|
System.Action<IAsyncOperation<TObject>> |
Implements
Explicit Interface Implementations
IAsyncOperation.Completed
Occurs when completed.
Declaration
event Action<IAsyncOperation> IAsyncOperation.Completed
Returns
Type | Description |
---|---|
System.Action<IAsyncOperation> |
Implements
IAsyncOperation.Result
Declaration
object IAsyncOperation.Result { get; }
Returns
Type | Description |
---|---|
System.Object |
Implements
IAsyncOperation.Retain()
Internally marks operations to not automatically release back to the cache.
Declaration
IAsyncOperation IAsyncOperation.Retain()
Returns
Type | Description |
---|---|
IAsyncOperation | Passes back this |