- Home /
is it safe to save info in PlayerPrefs?
i need to save some info in my game running on android. device i saw that i can use PlayerPrefs for this. the question is how safe is this? can i save the amount of in game money the user earned for example? does the data encrypted some how?
p.s, unity document speak only on windows,osx, linux and web. doesn't say anything about mobile...
Answer by Yury-Habets · Nov 25, 2013 at 08:44 AM
I guess the data is saved to android.content.SharedPreferences.
So this definitely needs some encryption if you want to store sensitive info (rooted devices are not protected from modification). Encrypting the file itself may be not a very good idea. You could encrypt the value, but another threat here is a "Replay attack" when the whole encrypted value in the file is replaced by a known encrypted value that means much gold :) You need to decide the desired level of security/paranoia.
You also might want to check
http://stackoverflow.com/questions/4909999/encrypt-data-in-sharedpreferences
HTH
Answer by DavidDebnar · Nov 24, 2013 at 05:49 PM
Yes, it's safe. The data isn't encrypted, but since you're on Android, it probably won't matter as much, because Android by default doesn't allow for users to edit it. The user can always download a file manager, but then again, nothing is unhackable.
-David
any idea where the data saved in android? i would like to inspect it my self. i may want to encrypt my data with simple algorithm.
thanks.