So i’m learning how to make game apps myself and so far i’ve been doing amazing! very pumped but I encountered an issue that I don’t exactly know what’s wrong as everything is running and coded right… as far as I know that is.
So here is my code
static int score = 0;
static int highscore = 0;
static public void AddPoint(){
score++;
if (score > highscore) {
highscore = score;
}
}
void Start(){
highscore = PlayerPrefs.GetInt ("highscore", 0);
score = 0;
}
void onDestroy(){
PlayerPrefs.SetInt ("highscore", highscore);
}
Highscore just won’t save… it keeps updating everytime I get a score but restarts to 0 when I replay the game… thank you.