DeleteObjectAsync
method in Coherence.Cloud.CloudStorage
Methods
public StorageOperation DeleteObjectAsync(StorageObjectId objectId, CancellationToken cancellationToken = default)
Deletes an object from cloud storage.
Parameters
Type | Name | Description |
---|---|---|
StorageObjectId | objectId | Identifier of the object to delete. |
CancellationToken | cancellationToken | Used to cancel the operation. |
Returns
Type | Description |
---|---|
StorageOperation | The status of the asynchronous operation. |
Remarks
If no object with the specified identifier exists, the returned StorageOperation's IsCompletedSuccessfully is set to true, but no object will be deleted.
Examples
using Coherence.Cloud;
using UnityEngine;
class CloudStorageDelete : MonoBehaviour
{
async void Start()
{
PlayerAccount playerAccount = await PlayerAccount.GetMainAsync();
var cloudStorage = playerAccount.Services.GameServices.CloudStorage;
await cloudStorage.DeleteObjectAsync(("type", "id"))
.OnFail(Debug.LogWarning)
.OnSuccess(() => Debug.Log("Deleted"));
}
}
Exceptions
Type | Condition |
---|---|
StorageException | When not logged in, StorageErrorType is set to NotLoggedIn. |