This question could be about Unity.
If it is not important data, I am thinking of not updating it to the server immediately after the change, but only in special circumstances. I'm considering updating the application when I close it this way, what do you think about this?
Answer by Sarah Zhang · Apr 22, 2021 at 10:32 AM
Setting the data in the OnApplicationQuit() function is ok. The code could be something like this code snippet of PlayFab SDK.
Of course, we would still suggest you store the data regularly including saving the data locally to prevent data loss due to program crashes. If as you said, the data is not important, you can entirely store the data temporarily locally, then upload it when the application quit. If so, when the game crashes, the client can still hold the data and wait for the next upload.
Besides, you can also consider using the Unity method Unity - Scripting API: Application.quitting (unity3d.com) or Unity - Scripting API: Application.wantsToQuit (unity3d.com) to raise the event when the application quitting. If you have the more advanced questions about Unity API and the Unity script life cycle, please navigate to the Unity forum for the professional support.
@Sarah Zhang Thank you, but I have one question. Is there a way to distinguish if the server's data and local backup data are different when receiving user data from the server, whether it is tampered with or not uploaded to the server?
Generating MD5 value for local data file can prevent some cheaters. Or you can consider using asymmetric encryption for your data, you can encrypt it in Unity, and unencrypt it on Cloud Script using Azure Functions.
But if you have high security requirements for this part of the data, please upload the encrypted data directly instead of storing it locally.
Thank you for your kind answer.
I'm sorry, but could you explain the encryption in detail?
Answer by Jung Ho June · Apr 21, 2021 at 03:52 PM
i was used that solution for my ue4 game
but sometimes the data not upload so it cause critical error.
so i decided to auto upload every 50 sec.
What happens after I overstep the free limit of updates per user 1 Answer
Questions on storing a list of strings on PlayFab to be accessed by all users, or similar methods 2 Answers
Stay logged in when the scene changes 1 Answer
Soccer Manager - Handling of soccer players / data 1 Answer
After trying to delete userdata (for testing) with DeleteAll() function, it doesnt work anymore? 1 Answer