Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question editor tool

Discussion in 'Cloud Save' started by unity_D4A6C01F3EBB83613B4D, Nov 18, 2022.

  1. unity_D4A6C01F3EBB83613B4D

    unity_D4A6C01F3EBB83613B4D

    Joined:
    Oct 19, 2022
    Posts:
    5
    I use anonymous sig-in for development testing. Is there any way to create editor tools for cloud?
     
  2. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    43
    Could you give me more information on the use case you are mentioning? What is it you are trying to achieve and where is the issue occurring that is blocking you?
     
  3. unity_D4A6C01F3EBB83613B4D

    unity_D4A6C01F3EBB83613B4D

    Joined:
    Oct 19, 2022
    Posts:
    5
    Hi! I use cloud save to save the player game save. I need a tool (editor preferably) to manage the data (uplload/remove/etc). It works sometimes, yet sometimes i get:


    ServicesInitializationException: You are attempting to initialize Unity Services in a non-Unity Thread. Unity Services can only be initialized in Unity Thread
    Unity.Services.Core.UnityServices.InitializeAsync (Unity.Services.Core.InitializationOptions options

    As of now i noticed it works after a gameplay when the services are still authorised
     
  4. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    43
    Unfortunately, you won't be able to use cloud save in this way. The actual editing of cloud save data must be done from the dashboard. The reason for this is that clients can only receive and upload their own data and won't be able to access other users.

    You can save data by sending it from the SDK in editor by using the following:
    public async void SaveSomeData()
    {
    var data = new Dictionary<string, object>{{"key", "someValue"}};
    await CloudSaveService.Instance.Data.ForceSaveAsync(data);
    }

    You can also delete keys using the SDK in editor through the following
    public async void DeleteSomeData()
    {
    await CloudSaveService.Instance.Data.ForceDeleteAsync("key");
    }

    You can find more information on how the Cloud Save SDK works here. However, the only way to access another user's data would be through Cloud Codes Service Level tokens, you can find more information here.
     
  5. unity_D4A6C01F3EBB83613B4D

    unity_D4A6C01F3EBB83613B4D

    Joined:
    Oct 19, 2022
    Posts:
    5
    Well that's exactly what i'm doing. And only changing the current user data is what i'm doing, i don't want to acces all users data! BUT unity throws an error on authorization (which as far as i understand is needed for proper cloud data sync).
    So in the end i can't even change the current user data if i'm not in a play mode.
     
  6. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    43
    The SDK can only be used during the runtime of the game itself. The reason for this is that the authentication needs to happen on the player level. You should be able to use the cloud save API if you authenticate as the user externally from Unity. You can find more information on the Cloud Save REST API here. This API will still need to be used during runtime of the user so the other method available for this circumstance would be to use the service token with Cloud Code to access another player's data and modify it. This will require you to see the other players' Authenticated userID which can be retrieved using Lobby after you interact with the user in a server. This guide will show you how to use Cloud Save data and access it from Cloud Code.