Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

HighScore wont save Through PlayerPrefs

$
0
0
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.

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>