- Home /
Playerprefs not working on android
I am making a shop for my game where a player can buy stuff.when he buys an item the value of the item in playerprefs is incremented by once.this works correctly in the editor but stays zero in android.i hav made a keystore and have also added playerprefs.save() after every operation but this does not seem to make it work.please help.here a code snippet:- //buy button
if(GUI.Button (Rect (originalWidth -160,originalHeight -100,70,30), "BUY"+":Rs "+cost.ToString()))
{
if(money>=cost)
money-=cost;
buy=true;
}
//if buy =true
temp2=PlayerPrefs.GetInt("kite1");
temp2+=temp1;
PlayerPrefs.SetInt("kite1",temp2);
PlayerPrefs.Save();
here temp 1 is the no of times the user presses the button and temp 2 is the variable taht storest he value of the playerpref.
Your answer
Follow this Question
Related Questions
PlayerPrefs don't load again after Android game closes for the first time. 1 Answer
Android/IOS: Sharing save file between free and paid versions 0 Answers
How to save an item as bought in player prefs? 0 Answers
is it safe to save info in PlayerPrefs? 2 Answers
Player Prefs Dosen't work on android 0 Answers