Class AsyncOperationBase<TObject>
base class for implemented AsyncOperations, implements the needed interfaces and consolidates redundant code
Inherited Members
Namespace: UnityEngine.ResourceManagement.AsyncOperations
Syntax
public abstract class AsyncOperationBase<TObject> : IAsyncOperation
Type Parameters
Name | Description |
---|---|
TObject |
Constructors
AsyncOperationBase()
Basic constructor for AsyncOperationBase.
Declaration
protected AsyncOperationBase()
Properties
DebugName
A custom operation should override this method to provide a debug friendly name for the operation.
Declaration
protected virtual string DebugName { get; }
Property Value
Type | Description |
---|---|
String |
Progress
A custom operation should override this method to return the progress of the operation.
Declaration
protected virtual float Progress { get; }
Property Value
Type | Description |
---|---|
Single | Progress of the operation. Value should be between 0.0f and 1.0f |
Result
Accessor to Result of the operation.
Declaration
public TObject Result { get; set; }
Property Value
Type | Description |
---|---|
TObject |
Methods
Complete(TObject, Boolean, String)
Complete the operation and invoke events.
Declaration
public void Complete(TObject result, bool success, string errorMsg)
Parameters
Type | Name | Description |
---|---|---|
TObject | result | The result object for the operation. |
Boolean | success | True if successful or if the operation failed silently. |
String | errorMsg | The error message if the operation has failed. |
Remarks
An operation is considered to have failed silently if success is true and if errorMsg isn't null or empty. The exception handler will be called in cases of silent failures.
Destroy()
This will be called by the resource manager when the reference count of the operation reaches zero. This method should not be called manually. A custom operation should override this method and release any held resources
Declaration
protected virtual void Destroy()
Execute()
This will be called by the resource manager after all dependent operation complete. This method should not be called manually. A custom operation should override this method and begin work when it is called.
Declaration
protected abstract void Execute()
GetDependencies(List<AsyncOperationHandle>)
A custom operation should override this method to provide a list of AsyncOperationHandles that it depends on.
Declaration
protected virtual void GetDependencies(List<AsyncOperationHandle> dependencies)
Parameters
Type | Name | Description |
---|---|---|
List<AsyncOperationHandle> | dependencies | The list that should be populated with dependent AsyncOperationHandles. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |