Editing PlayerPrefs directly in plist

In Unity on OSX I am trying to edit the PlayerPrefs values in the unity.companyName.productName.plist, but every time I start the game they get overwritten with the old values. Is there a way to do this directly?

That's weird. That implies that Unity keeps a separate, secret settings file somewhere else that it can use for backups!

–

2 Answers

2

Spent some time battling with this, and learned that OS X Mavericks caches prefs in memory. Any manual edits to the plist are ignored. In addition to editing the plist while Unity is closed, you must also invalidate the cache. In my experience, this works:

Quit Unity, make your edit, and then issue these commands in a terminal:

defaults read ~/Library/Preferences/your.plist.here

defaults read your.plist.here

Yes, both commands, and obviously replace your.plist.here with the filename of your plist. Bonus points: make a backup of your plist before trying any of this.

Man this has been annoying me for ages. I didn't need the second defaults read command, but otherwise it worked a treat.

–

can't upvote it, but at least i'll leave a comment here: you've saved my day with this 'defaults' command. thanks.

–

Using the defaults command is the correct answer since Mavericks, due to all the voodoo caused by cfprefsd.

–

Quit the Unity editor before editing the .plist file.

What that's it? I thought there was some kind of mystery here...

–

Kinda sucks to have to exit each time, but thanks!

–

I still have the problem with Unity 4.2.2f1 . The file is always overwritten. Quit and restart the application don't work.

–