Hey everybody so i tried a high score system for my game but im running into a few issues with it which i need help on. Sorry i’m a beginner and still learning how to make a decent high score system.
Issue #1 : The score is displayed, but the “Best Score” is always 0 is there anyway to make best score show the previous highest score in the game? Pic
Issue #2 : So in my game the score system is not displayed in the beginning , but after the game ends it does not turn on. Is there anyway to display the score after the game ends? In the Pic i provided i had to manually turn it on in the hierarchy/Inspector view. I want it to turn on after the player has lost all their lives.
Here is my scripts
void OnGUI()
{
if (playerLives == 0 && player == null)
{
scoreTxt.text = "Score: " + score.ToString ();
bestText.text = "Best: " + PlayerPrefs.GetInt ("Best");
scoreTxt.gameObject.SetActive (true);
bestText.gameObject.SetActive (true);
}
}
If you can help with my issue thank you!