So I'm updating my game, but will need all my players to have a new save. How do I clear all of their data when they play my game, but avoid clearing it after that?
PS. WebGL build
Answer by senjupraveen
Mar 21 at 08:16 AM
PlayerPrefs.DeleteAll(); use this it remove all the data stored in playerprefs
Answer by herDev
Mar 21 at 07:07 AM
In my opinion you shouldn't try and clear the data in this case, because you would need to flag that it's a first launch post-update and ideally keep track of that with back-end data or it will get messy.
Instead, why not assign the player save data to new key names? At the same time, you can manually delete the old player preference keys if they exist. That way, post update all your players will have fresh save game data and you can clean up the old keys.
Hope that helps!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
74 People are following this question.
how to properly save an int value ?
What is the best way to load an instance of a gameObject when loading a saved game?
How to deserialize after I've added more members to a class
Importing and exporting save files.