I have a scene that shows a users score for that round and the highest score gotten in the level. The high score works fine, and updates accordingly each time I beat the last highscore. The problem is, my current score always says 0 instead of what I actually got in that round. Code:
##gameOver.cs##
if (currentLevel == "colorCoded")
{
colorCoded.active = true;
colorCodedScore.text = "Score: " + PlayerPrefs.GetInt("colorCodedScore", GUICounters.score);
colorCodedHighScore.text = "High Score: " + PlayerPrefs.GetInt("colorCodedHighScore", GUICounters.highestScore);
}
else
colorCoded.active = false;
#colorCodedScore.cs#
if (PlayerPrefs.GetInt("colorCodedHighScore", GUICounters.highestScore) < GUICounters.score)
{
GUICounters.highestScore = GUICounters.score;
PlayerPrefs.SetInt("colorCodedHighScore", GUICounters.highestScore);
}
else
PlayerPrefs.SetInt("colorCodedScore", GUICounters.score);
GUICounters.score = 0;
GUICounters.timer = 0;
Application.LoadLevel("endGame");
Can anyone see anything wrong with the above?
↧