hello im facing a problem in my scrpit
the thing is that i can`t save or get the highscroe
here is the code you can cheak it
addPoint() is called when i want to increase the score and put it in the GUI text
thank you
static var score = 0;
static var highScoreValue= 0;
static function addPoint(){
score++;
if(score>highScoreValue){
highScoreValue=score;
}
}
function start(){
highScoreValue = PlayerPrefs.GetInt("highScore");
}
function OnDestroy(){
Debug.Log("cheak if destroy");
PlayerPrefs.SetInt("highScore",highScoreValue);
PlayerPrefs.Save();
}
function Update () {
guiText.text = "Score : " + score + "
highScore: " + highScoreValue;
}