メインコンテンツまでスキップ

プレイヤーレコードを削除する - クラウドセーブ - (Unity モジュール)

Last updated on May 30, 2024

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

  1. Log in to the AGS Admin Portal and go to your game namespace dashboard.

  2. Go to Progression & Inventory > Cloud Save > Player Records.

  3. 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.

  4. Click View next to the player record to enter its details page.

  5. Locate the record you want to delete and click Delete next to it.

    注記

    Make 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

  1. Open CloudSaveEssentialsWrapper_Starter.cs.

  2. Create a new callback function that handles the deletion of player record process results. Add the AGS Game SDK Result and ResultCallback 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);
    }
  3. Create another function to call the DeleteUserRecord() function from the CloudSave class. The function will take the recordkey string to locate the desired player record. You will also have ResultCallback 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));
    }
  4. Call the DeleteUserRecord() function in CloudSaveEssentialsWrapper_Starter.

    _cloudSaveWrapper.DeleteUserRecord(
    "GameOptions-Sound",
    result => {
    if (!result.IsError)
    {
    Debug.Log("Success deleting the current player's 'GameOptions-Sound' record");
    }
    }
    );