Reputation: 677
I am using Unity 5 on iMAC. I have faced strange but true unknown issue with player prefs.
Issue :
On Unity Editor - I have stored integer value in player prefs that works fine in UnityEditor, and when i restart my game in unityEditor then It was saved and i can retrieve that older saved player prefs's value.
On Android/iOS Device - I have run that same code with device then behaviour will changed.During running game player prefs works fine and i can set and get that value. But when i restart the game then i lost that value and can't retrieve that saved value another time.
I am tired to solve that issue, but i can't get success.
Anyone know solution about this unknowing behaviour of player prefs ?
Thank you in advance.
Upvotes: 2
Views: 5865
Reputation: 3531
You can circumvent this, by using your own file/serialization solution. For example protobuf. You can read an excellent guide here.
Upvotes: 0
Reputation: 229
Do you use PlayerPrefs.Save()
after putting data?
If not read about it http://docs.unity3d.com/ScriptReference/PlayerPrefs.Save.html
Upvotes: 3