Playerprefs.dat Data Format

“On Windows Store Apps, Player Prefs can be found in %userprofile%\AppData\Local\Packages[ProductPackageId]>\LocalState\playerprefs.dat”

Hello, I was looking to save data in a Windows Store Unity application using PlayerPrefs and then be able to read the data outside of Unity later. However when I open the playerprefs.dat file I am unable to figure what the data represents. I tried to save an int value but I don’t see that value anywhere in the file. This is what I see:

ƒo
¢ s$ unity.player_session_background_time
1501107912327s! unity.player_session_elapsed_time 73140s unity.player_sessionid 723062367982245220

Is this file possible to read at all outside of Unity? Is the data format documented anywhere?

It’s not documented (and is thus a subject to change in the future), but it is pretty simple. First 4 bytes is the checksum, next 4 bytes is the size of the data. Then, data follows.

The first byte of each data item is the data format (“n” stands for 4-byte integer, “f” stands for 4-byte float, “s” stands for UTF8 string). Then, there’s a key value that’s an UTF8 string and there’s a value directly after it. Strings are saved by first writing their length in a 4 byte integer, and then writing the characters.

1 Like