PlayerAccountOperation<TResult>
Represents an asynchronous cloud operation related to a PlayerAccount that has logged in to coherence Cloud.
Type Parameters
TResult
Type of object returned if the operation succeeds.
Remarks
An async method can await the PlayerAccountOperation<TResult> to wait until the operation has completed.
Similarly, a Coroutine can yield the PlayerAccountOperation<TResult> to wait for it to complete.
ContinueWith(Action, TaskContinuationOptions) can also be used to perform an action after the operation has completed.
OnSuccess(Action<TResult>) and OnFail(Action<PlayerAccountOperationError>) can be used to perform different actions based on whether the operation was successful or not.
If PlayerAccountOperation<TResult>.HasFailed is true, then the operation has failed. If this is the case, then PlayerAccountOperation<TResult>.Error will be non-null and contain additional information about the error.
If a PlayerAccountOperation<TResult> fails, and the error is not handled in any way (PlayerAccountOperation<TResult>.HasFailed is not checked, PlayerAccountOperation<TResult>.Error is not accessed, OnFail(Action<PlayerAccountOperationError>) is not used, etc.), then the error will automatically be logged to the Console at some point (whenever the garbage collector releases the PlayerAccountOperationError from memory).
Methods
ContinueWith(Action, TaskContinuationOptions) | Specify an action to perform after the operation has completed (PlayerAccountOperation<TResult>.IsCompleted becomes true. |
ContinueWith(Action<PlayerAccountOperation<TResult>>, TaskContinuationOptions) | Specify an action to perform after the operation has completed (PlayerAccountOperation<TResult>.IsCompleted becomes true). |
GetAwaiter() | Gets an object that can be used to await for this operation to complete. |
OnFail(Action<PlayerAccountOperationError>) | Specify an action to perform if the operation fails (PlayerAccountOperation<TResult>.HasFailed becomes true. |
OnSuccess(Action<TResult>) | Specify an action to perform if the operation completes successfully (PlayerAccountOperation<TResult>.IsCompletedSuccessfully becomes true). |