Save automatically to Google Play Cloud

BACKGROUND
I am working on a game for Android that has been published on the Google Play Store.
And now I plan to add the cloud save feature as an update.
(FYI: I use Unity and Play Games plugin )

PROBLEM
After hours of research and experimentation, I am currently focused on how to save the game automatically.

My game is a collection of mini-games in which a player can continue to play until his life ends.
I want the save to happen automatically while the player is playing.

According to the plugin, this is how I save the cloud:

public void SaveGame (ISavedGameMetadata game, byte[] savedData) { /* code omitted */ savedGameClient.CommitUpdate(game, updatedMetadata, savedData, OnSavedGameWritten); } 

I need 2 parameters for the SaveGame function, the first is metadata, then the second is the data itself.

Anywhere I search (even on Google), I cannot find a way to generate metadata automatically.
Based on my research, I can get metadata from the function below:

 void ShowSelectUI() { uint maxNumToDisplay = 5; bool allowCreateNew = true; bool allowDelete = true; // I will need to call this function first // This will display a dialog to the player // The player will need to create a new save manually afterwards ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame; savedGameClient.ShowSelectSavedGameUI("Select saved game", maxNumToDisplay, allowCreateNew, allowDelete, OnSavedGameSelected); } public void OnSavedGameSelected (SelectUIStatus status, ISavedGameMetadata game) { // And then from the callback function I get the meta data // (ISavedGameMetadata game) if (status == SelectUIStatus.SavedGameSelected) { // handle selected game save } else { // handle cancel or error } } 

Thus, the user will need to open a dialog, and then create a new save on their own.
This cannot happen in my game, as I need to save every time a player loses.

LINK
I know that it should be possible, a game called Get Bigger! A maul can save progress every time the player loses without opening a save dialog.

Question
Can someone give me any information about this?
I spent all day without an answer ...
Any help would be greatly appreciated.

+6
source share
2 answers

I personally am not familiar with the asset with which you are trying to keep statistics. However, I used this Stan Native asset, which I personally can recommend.

If you want something else for free, there are these links, Search native

In any case, you should check the Google Tutorials on working with the tag cloud, the Android site has a lot of information that does not include Unity. Android Developer

0
source

As already mentioned here , you can open a new snapshot without having to select it from the list, just specify the file name, if it exists, it will use it, otherwise it will create a new one.

Something like that:

  ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame; savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, delegate(SavedGameRequestStatus status, ISavedGameMetadata metadata) { // your code here .... }); 
0
source

Source: https://habr.com/ru/post/988655/


All Articles