- Home /
Question by
Nedcallescarlett · May 05, 2017 at 01:24 PM ·
javascriptplayerprefssave datasaveloadhighscores
High Score with player prefs confusion (JAVA)
I have to make a high score display on the game over and menu scene, Right now I have just once you die, it displays the score you had gotten from that run on the game over scene and then resets wen you go back to menu. I have no idea how to use player prefs at all. No idea how to save or retrieve date from it. Basically I need to save the scores I get and then make the one with the highest value display on a different (the gameover and menu) scenes.
Score Script(JAVA):
static var CurrentScore : int;
var InternalScore : int;
var ScoreText : GameObject;
function Update () {
InternalScore = CurrentScore;
ScoreText.GetComponent.<Text>().text = "" + InternalScore;
}
Don't know if this is needed, but this is how you obtain points: (java)
function DeductPoints (DamageAmount : int) {
GlobalScore.CurrentScore +=10;
}
Comment