Saving Highscores based on time

I have Struggles with Saving my Highscores. i did read something about Playerprefs but i didnt get it.

this is my Code :

#pragma strict
var myScore : int;
var scoreText : GUIText;

function Start () {

}

function Update () {
	myScore ++;
	scoreText.text = 'Score:' + myScore;
}

could anyone help me with this Save system?

I guess it is to save the score you want since the code is working fine (by this i mean that the GUI-text increase every time the update function is called). Then you should take a look at this answer. Click Here!. I think this answer your question in a simple and good way, and i don’t think I can do it much better. It also includes a simple code example! :slight_smile:

Hope it helps!

you should save your score when you want to exit and load it when you start the game

function Start () {
  myScore = PlayerPrefs.GetInt("Score");
 }

function whenExit(){
  PlayerPrefs.SetInt("Score", myScore);
}

Thanks Guys it Worked!