[Solved] Unity3D – playerpref values changes to negative when its over 2billion


As I commented you, you should change your variable type, in this case to float which is the only one supported in Unity to save in PlayerPrefs. So your code would be like:

public float LoadCoinsAmount()
{
    return PlayerPrefs.GetFloat("COINS");
}

public void SaveCoinsAmount(float coins)
{
    PlayerPrefs.SetFloat("COINS", coins);
}

4

solved Unity3D – playerpref values changes to negative when its over 2billion