Hi Marko,
What sort of data are you trying to store on pause ? Unity also has an OnApplicationQuit() method but I'm not sure if you would have enough time to save the Data after that either. Can you let us know a little bit more about your game ? It might be best to set up your game so this data is only sent when a player hits a check point or completes a certain challenge such as finishing a level, some sort of trigger that will allow the data to be updated at a point when the player wouldn't be leaving the game straight away would be ideal. If a player leaves mid game you can use SetDurable to queue events and send them to a player comes back online on that device, similar to what you're doing at the moment. Another choice would be a warning when a player is quitting letting them know its been X amount of time since the last save was made, you could prompt them to save here after they have pressed pause. For players hard quitting the game they will just have to lose the data since their last save or use the Durable queue to upload the data when they come back online. Hope this helps.
Thanks,
Liam
Marko Keronen
Hello!
I've been trying to save my game's data on GameSparks using a LogEventRequest when the game is paused on Android (which I guess is the usual way the game is shut down by most Android players). Sadly, it seems that calling the LogEventRequest in Unity's OnApplicationPause() doesn't have enough time to actually save the data online. If the game is resumed right after it was paused, the LogEventRequest goes through and saves successfully.
Are there any best practices for saving the latest game state online when the player wants to quit the game on Android? So far, my best choice has been to save the game locally when pausing (as a sort of a cache), and uploading this local save online when the game is started the next time. But its meant to be possible that the game is played on multiple devices, this approach means the the other devices will practically never have the latest save data, since leaving the game doesn't manage to save it.
Any thoughts?
Best regards,
Marko