Sorry to have to ask, but im relitively new to unity and, though I have done a lot of research, I simply can’t seem to find what im doing wrong here,
each time I play the game or reset the level, the highscore is reset to 0 with the score.
Heres my code:
using UnityEngine;
using System.Collections;
public class Score2 : MonoBehaviour {
public int score=0;
public int highScore;
// Update is called once per frame
void FixedUpdate () {
score++;
if (score > highScore){
highScore = score;
PlayerPrefs.SetInt("highScore", highScore);
PlayerPrefs.Save ();
}
guiText.text = "Score: " + score + "
HighScore: " + highScore;
}
void Start(){
score = 0;
PlayerPrefs.GetInt(“highScore”);
}
}