- Home /
How to SECURELY save variables?
Is it a good idea to save the game's coins (gained through in-app purchases)and scores using playerPrefs? OR to make such variables static?
Are these methods secure to implement for server side and local scoring? and hence are they safe from any hacking cases?
EDIT
A more clearer question: How can I keep/save variables without having the using tinkering with the values OR what is the best technique for such security
PlayerPrefs is not handled server side, it saves data locally, your only truly safe bet is to keep a tight grip on the data from your end..
Thanks for clearing it out. What I really wanted to mean is secure saving both server and local.
I'm still hoping for other answers or comments. Are there other methods to keep variables safe from hacking?
Answer by Azial · Mar 16, 2013 at 01:54 PM
You could keep track of how the coins are earned somehow. Or you make a algorithm for encrypt/decrypt the amount of coins and store this in the prefs, maybe even as strings or some other type. So in worst case for the hacker he would decrease the coins.
any algorithm contained within the code is not helping much, it is right there to crack! you NEED to keep this data on the SERVER SIDE, or it is simply not secure
Thanks Azial! Can I use a ready made encrypt/decrypt algorithm?
But would the algorithm be visible after compiling? But yeah, maybe your on the safer side with Seths suggestion.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094522im_/https://answers.unity.com/themes/thub/images/avi.jpg)