Hey all, We're about to push out an update for an iPhone app, and had a question... if a user downloads an update, is their PlayerPrefs file wiped?
May I add a question to this post... Where is this data stored? The iPhone docs weren't updated with this info. file:///Applications/Unity%20iPhone/Documentation/ScriptReference/PlayerPrefs.html only describes the OSX, Windows and Web player versions...
Your player prefs will not be wiped when users download an update. As for little angel's question, I'm not 100% sure.
Player prefs are stored in one of the app's data directories (can't recall which one off the top of my head) and are backed up by iTunes when you sync. When you update, the app is erased, the new app is installed, and the prefs are restored to the app's directory.
Resurrecting another old thread... What if the player downloaded my game and hasn't synced or backed up with iTunes, then downloads my update straight to the phone? Is the data intact or overwritten? And what if the player deleted the game from the phone before getting the update...say the just went to the iTunes link and "rebought it" for free? My update is coming just a few weeks after initial release so this is a possible scenario.
Sorry to bump this so soon, but I really need to know this. I have an update pending an answer to these questions. Thanks
If he downloads the update straight from his iphone the PlayerPrefs will be untouched. Deleting it from your iphone and rebuy it will result in deleted PlayerPrefs. Don't know what it does when you sync with iTunes again.
Thank you for the fast answer. Now if I can get an answer for that last bit: I need to know what happens in this instance. Would the current playerprefs be completely erased, merged....? Dealing with high score cheaters and want to cover all the possible "loop holes" without deleting everyone else's scores. Thank you
You can't stop the PlayerPref cheating. The problem lies with the JailBroken iPhones. Those guys can open up the PlayerPrefs file and change whatever they want to whatever they like. But as I think of it, you do got the Unity piracy check in your game right? (If you can't reach a highscore you can't temper with it either
I did some sneaky stuff outside of playerprefs to thwart those cheaters. Can you link me to the Unity Piracy Check thing? I don't have it...that would be great! Thank you very much!!!
Use the boolean of iPhoneUtils.isApplicationGenuine. I have two variants of it, disable all the menu buttons except the credits. Or change the behavior of the start game button and do a call to Application.OpenURL(itms://itunes-url)
Cool. I just actually found a topic on that. Apparently there's no way to test it before submission but it seems simple enough. So some hacking the "playerprefs" (so to speak) will make it not pass the genuine test? Thanks again!
I posted an "encryped playerprefs" class a while back. It's old code (was still learing Unity then), but it works, and should make it harder to hack. Do a search for encryptedplayerprefs. Basically it just stores everything as usual, but it also adds an md5 hash for each playerprefs var. If the hash isn't there or invalid, then it doesn't read the playerprefs values. Off course it's only good if you use it from the start - unless you add a script that converts old data to use this, and only perform this the first time the update is installed (so set another playerprefs var to indicate that it has been converted).
Well not exactly but I'll try to explain. If someone cracks your App (and it will happen!) then the IsGenuine will return false. If its false then you should not let them reach a highscore. If there is no highscore set in the PlayerPrefs, they can't change the score. On a non jailbroken iphone you can't access, and thus change, the PlayerPrefs file. So you hack highscores on a non jailbroken iphone. Thats smart, I like it!
Thanks guys @smag...I saw that code before, I don't know if I can figure out how to use it. The game has been hacked already of course. I don't care so much. I just want to keep the highscores legit. I worked some code that will complicate things for highscore cheaters as well as save legit scores when the app is updated. The good news is that "Dave" is hovering around #20 in Top Paid Apps so I can't really complain too much, especially since this is my first game Thanks again so much!!!
I just checked your game this morning on AppAnnie and it is indeed doing very well! Congratulations! If you ever feel like inspiring other people or want to share stats, check this topic