For some reason with my code below if I get a score greater than my previous highscore it does not show as New highscore: X but just as highscore: X.
public void GameOverScore()
{
if (Score > PlayerPrefs.GetInt("Highscore"))
{
PlayerPrefs.SetInt("Highscore", Score);
HighScoreScript.manager.newHighScore();
ScoreScript.manager.LatestScore();
}
if (Score <= PlayerPrefs.GetInt("Highscore"))
{
PlayerPrefs.SetInt("LatestScore", Score);
HighScoreScript.manager.highScore();
ScoreScript.manager.LatestScore();
}
}
That code links with this:
public void newHighScore()
{
HiScore.text = "New Highscore: " + PlayerPrefs.GetInt("Highscore").ToString();
}
public void highScore()
{
HiScore.text = "Highscore: " + PlayerPrefs.GetInt("Highscore").ToString();
}
Can anyone spot what’s wrong?