Delete the player record - Cloud saves - (Unity module)
About deleting player records
The AccelByte Gaming Services (AGS) Admin Portal supports all operations with player records, including creation, editing, and deletion. You might want to delete a player record if, for example, there is an issue with it. You can do this either manually on the Admin Portal or by using the delete function provided in the AGS Game SDK.
Delete record via the Admin Portal
- AGS Shared Cloud
- AGS Private Cloud
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Progression & Inventory > Cloud Save > Player Records.
Click the dropdown next to the search box and select by User ID. Paste the player's User ID in the search box and press Enter.
Click View next to the player record to enter its details page.
Locate the record you want to delete and click Delete next to it.
noteMake sure it is the correct player record you want to delete. If you just want to reset the record, you can edit the JSON directly instead of deleting the player record.
Log in to the AGS Admin Portal and go to your game namespace dashboard.
Go to Progression & Inventory > Cloud Save > Player Records.
Click the dropdown next to the search box and select by User ID. Paste the player's User ID in the search box and press Enter.
Click View next to the player record to enter its details page.
Locate the record you want to delete and click Delete next to it.
noteMake sure it is the correct player record you want to delete. If you just want to reset the record, you can edit the JSON directly instead of deleting the player record.
Delete record via the SDK
Open
CloudSaveEssentialsWrapper_Starter.cs
.Create a new callback function that handles the deletion of player record process results. Add the AGS Game SDK
Result
andResultCallback
as parameters so the result will be accessible from other scripts.private void OnDeleteUserRecordCompleted(Result result, ResultCallback customCallback = null)
{
if (!result.IsError)
{
Debug.Log("Delete player record from client successful.");
}
else
{
Debug.Log($"Delete player record from client failed. Message: {result.Error.Message}");
}
customCallback?.Invoke(result);
}Create another function to call the
DeleteUserRecord()
function from theCloudSave
class. The function will take therecordkey
string to locate the desired player record. You will also haveResultCallback
a parameter so the result can be accessible from other scripts.public void DeleteUserRecord(string recordKey, ResultCallback resultCallback)
{
cloudSave.DeleteUserRecord(
recordKey,
result => OnDeleteUserRecordCompleted(result, resultCallback));
}Call the
DeleteUserRecord()
function inCloudSaveEssentialsWrapper_Starter
._cloudSaveWrapper.DeleteUserRecord(
"GameOptions-Sound",
result => {
if (!result.IsError)
{
Debug.Log("Success deleting the current player's 'GameOptions-Sound' record");
}
}
);