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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How can I save currencies / inventory items with Cloud Save in Virtual Shop use case ?

Discussion in 'Unity Gaming Services General Discussion' started by ShottaPanda, Jul 24, 2022.

  1. ShottaPanda

    ShottaPanda

    Joined:
    Jul 26, 2017
    Posts:
    4
    Hello,

    First of all, thank you for theses new features available in UGS !

    I'm trying to explore the Unity services samples use cases, in particular Virtual shop use case. So, I set it up on my dashboard as explained in the README file in order to test a build on my Android device. Economy and Remote config work well but when I uninstall the game from my phone and then re-install the apk I lose all the currencies and inventory items, the virtual shop and player data are totally reset.

    Two questions maybe :

    Have you planned to use cloud save in the Virtual Shop use case, available in github, in order to save player data like currencies and inventory items ? (maybe during the implementation of IAP service ?)

    If not, Is it possible to find an example of using Cloud Save to save theses kind of data ?

    Kind regards,

    ShottaPanda
     
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    268
    Hi ShottaPanda,

    Thanks for the great feedback!

    What you are describing would also happen with cloud save. The reason for this is because you are probably signing in anonymously. Cloud save also needs a user to save to.

    When you uninstall an application the cache will also be removed and a new user will be signed in anonymously.

    To avoid this, I invite you to explore the authentication SDK

    This will help you sign in with a specific user. Once you uninstall and come back play the game once again. The services will start with the signed in user.

    Let me know if this helps you out.
     
    tony_c-unity3d likes this.
  3. ShottaPanda

    ShottaPanda

    Joined:
    Jul 26, 2017
    Posts:
    4
    Thank you for your quick answer !

    I will try the authentification SDK with Platform-specific authentification (I guess).

    And if I understand, I don't have to use Cloud Save to save currencies and inventory items, only Economy and Platform-specific authentification services will do the job ?

    Best regards
     
  4. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    268
    Hi ShottaPanda,
    That is correct, CloudSave can be used additionally for any player data that you would like to save.
    example: Completed level, Unlocked secrets, Player Health etc... However Economy will save the Economy information per user without the need of Cloud Save.

    Another quick note here. If you implement your own sign in feature, you would be able to reload that user without needing platform specific authentications. (Of course this would require more work unless you already have something in place)
     
  5. ShottaPanda

    ShottaPanda

    Joined:
    Jul 26, 2017
    Posts:
    4
    Thank you again for your answer ! This is perfect that Economy will save the Economy information.

    I'm going to use platform specific authentications (Google play authentication for android) because I don't really know how to perform my own sign in feature.
     
  6. tony_c-unity3d

    tony_c-unity3d

    Unity Technologies

    Joined:
    Jul 18, 2019
    Posts:
    35
    Hi @ShottaPanda,

    I just wanted to confirm what @SebT_Unity described. That use case definitely uses anonymous login so, when you deleted and reinstalled the app, it just created another user. Your old data is still attached to the old player id but now you're logged in as a new player. If you log in with Google play authentication, players can keep the UGS data between installs.

    And yes, Economy stores all inventory items and currency values without need of Cloud Save, and Cloud Save can be used independently of Economy to store any additional data your app might require. The 2 services work separately, or, for more complicated problems, they can be used together as occurs in samples such as Battle Pass which grants economy items (both currency and inventory items) and uses Cloud Save to store the state play such as experience gained and rewards claimed.

    If you have any other questions, please don't hesitate to reach out. Best of luck @ShottaPanda!
     
    richj_unity likes this.