Question by
ChompIV · Apr 29, 2017 at 03:08 AM ·
javascriptplayerprefsscorehighscores
Highscore with player prefs help. (JAVASCRIPT)
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