Upgraded a project to 5.5 (don’t worry it’s backed up!) and straight away I’m into a weird little problem. My project can’t find existing reg keys that have been set by older version of Unity’s PlayerPrefs. I set up a quick script to recreate the things it couldn’t find and things are working now.
But the keys that have been created/modified are not in the expected place. For example, I can see my old keys, values of which have been changed by my ‘quick fix’ script (according to Unity when the project runs, but not according to regedit). So in fact, they haven’t been modified, but new ones have been created elsewhere. But I can’t find them!
Quick check of 5.5 docs says keys should be in the expected place - HKCU\Software[company name][product name] - But I have used exactly the same key names in my fix script, and I can see in the reg editor that the values have not changed- yet my project when it’s running is picking up these new values from somewhere!
TL;DR PlayerPrefs are freaking me out because I’m not seeing keys appear where expected but Unity is finding them from somewhere, but I don’t where. Anyone else had this weird behavior?
For some reason, Unity seems to now be saving the PlayerPrefs under HKCU\Software\Unity\UnityEditor[company name][product name]. On Android, it still found my old save file with no problems, so I’m guessing it was just moved for Windows or maybe this is a bug since the Unity scripting documentation hasn’t been updated.
Indeed this is very confusing, because the documentation needs to be updated because it wrongly states:
“On Windows, PlayerPrefs are stored in the registry under HKCU\Software[company name][product name] key, where company and product names are the names set up in Project Settings.”
…for both “in Editor” and “Standalone”.
I used export/tweak in notepad/import in Regedit to copy back my keys into this new path…
Wait, I just updated to 5.5 and having the same problem, but… Are you saying that when I run the game in the Editor, my prefs will be stored in the HKCU\Software\Unity\UnityEditor[company name][product name] path but when I run it standalone they’ll be stored in the regular HKCU\Software[company name][product name path? Why make that change?
My installers write registry entries as part of the install, at that regular path. When I run my game in the Editor, I don’t want to have to create a separate installer with all new paths in it just so I can do my testing. That’s annoying as hell and just slows things down. I want to be able to test my game while developing and have it read from where the actual game will read from. And yes, I know I can copy the key from one place to another in the registry, and that’s what I ended up doing, but that doesn’t address the real issue.
PLEASE stop messing with the registry paths, unless absolutely necessary to solve some game breaking issue. This is the second time in a few months that the registry paths have been messed up. Please stop.