Wednesday, September 19, 2018

unity - Is it bad practice to store inventory and scores in PlayerPrefs?



I'm building a mobile game for a client in Unity. To save time, we started with a template game from the Asset Store that had some of the features that the client wants.


The game includes a progression system and shop, so we save the user's scores, progress, in-game currency, inventory, etc. We currently have no plans to export the save data.


The template game uses PlayerPrefs to store all save data. Is this bad practice? Assuming we don't include a button that calls PlayerPrefs.DeleteAll(), is there any extra risk associated with using PlayerPrefs instead of external files to store the player's data?



Answer



It is up to you, but on android at least it is very easy to reset these things on your phone. Most of the time it is best to save things that you do not want to lose externally so that the user cannot manipulate or delete it. I am not positive how easy it is to do on iOS, but on android all you have to do is go to the app in the application manager and clear the cache and it will remove all of those PlayerPrefs.


Overally it would not be a good option for things you need to hold on to. Especially things like in game currency as users can find ways to manipulate this data.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...