- Home /
Player Prefs question...
Hello. I want to use playerprefs for saving/displaying the player's high score. How can I make it so that only the largest score is saved? Would it be something like this:
if (score>PlayerPrefs.GetInt("Player Score") {PlayerPrefs.SetInt("Player Score", score);}
Thanks
Answer by Justin Warner · Jan 02, 2011 at 09:34 PM
var highestScore = 0; var score = 0;
function Update () { //I recomend putting this in its own function and only calling it at the end of the game... if(score > highestScore) { highestScore = score; }
}
Highest score will save then, and you can just show that on the GUI you need it to...
Hope this is kind of what you want =).
Your answer
Follow this Question
Related Questions
Setting which scene to load based on if you've played before? 1 Answer
player prefs, saving the Rect of a gui position? 1 Answer
Where does unity save player preds when testing in the editor? 2 Answers
Read only playerprefs? 1 Answer
Multiple Save (Saving & Loading System) With PlayerPrefs 2 Answers