Is There a PlayerPrefs Cache?

I was working on creating a player prefs file when I accidentally deleted a big chunk of a large, complex prefs file. I replaced the prefs file from an older version, but it didn’t make any difference. Unity continued to read and write the corrupted version of the prefs file. I eventually discovered that I had to quit Unity and relaunch in order for the replaced prefs file to be read.

Is there any way to clear this PlayerPrefs cache without quitting Unity? That can be very time consuming if done more than a few times.

1 Like

Will this work for you?

PlayerPrefs.DeleteAll ();

Or just go to your regedit.exe and delete your playerprefs manually. Dunno what you are using or which platform you are working on.

I’m on Mac OS. I went into the Library/Preferences folder and deleted the .plist prefs file for this app, then replaced it with a backed-up, non-corrupted version. Unity however continued reading and writing the deleted, corrupted version (apparently from a cache). I had to quit Unity, delete and replace the prefs file, then relaunch Unity for it to use the correct, non-corrupted version.

I didn’t try deleting prefs because I don’t want to have to start over creating the prefs file (a big job). I just want to go back and use the version of the prefs before I screwed it up.