Hi,
After Updating to Unity 5.5, I started to have some problems with the Player Prefs. They seem to be working … I mean, they save and load correctly, but I’m using some packages to explore the PlayerPrefs and I go manually check the register (I’m using Window) and the data that was previously there… is not anymore. If I save and load data, it shows null or nothing, but it still is being saved…
Did something important change in the update?
BTW, I checked up with new empty projects, I reinstalled, I even reinstalled windows Since I believed it was something corrupt in my PC.
I made a double installation with 4.3 and 5.5 and everything looks to work good in 4.3, but bad in 5.5…
any ideas?
I too am seeing this. It appears to only happen on windows 7 with large strings / REG_BINARY type of keys.
Update: Looks like it’s getting stored in HKEY_CURRENT_USER\Software\AppDataLow\Software\ sometimes!
Something changed with Low Integrity mode in 5.5. Unity - Manual: WindowsLowIntegrity
Here’s the code I wrote to fix it on my FreeCell Quest game.
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
const string highData = @"HKEY_CURRENT_USER\Software\Legend Studio\FreeCell Quest";
const string lowData = @"HKEY_CURRENT_USER\Software\AppDataLow\Software\Legend Studio\FreeCell Quest";
public static void PullMissingPlayerSavesFromLowIntegrity()
{
PullMissingPlayerSaveFromLowIntegrity("Player1_h28107335");
PullMissingPlayerSaveFromLowIntegrity("Player2_h28107332");
PullMissingPlayerSaveFromLowIntegrity("Player3_h28107333");
}
static void PullMissingPlayerSaveFromLowIntegrity(string playerKey)
{
var highDataPlayer = Microsoft.Win32.Registry.GetValue(highData, playerKey, null) as byte[];
if (highDataPlayer == null || highDataPlayer.Length <= 1)
{
var lowIntegrityPlayer = Microsoft.Win32.Registry.GetValue(lowData, playerKey, null) as byte[];
if (lowIntegrityPlayer != null && lowIntegrityPlayer.Length > 1)
{
Microsoft.Win32.Registry.SetValue(highData, playerKey, lowIntegrityPlayer);
}
}
}
#endif