Hey guys, so I am having trouble with my c# script.
What I want to happen
Have two UI texts.
one to count score while the game plays,
one to show the score in the middle of the screen when the game ends,
What is happening
The game over score and in-game score are both counting like the in-game is supposed to
I have gone over it multiple times and can’t seem to figure out my issue
This is all the relevant script
public Text gameOverScoreText;
public Text scoreText;
public Text highScoreText;
//the gameOver bool is triggerd by a game over event which sets Time.timeScale = 0
private bool gameOver;
void Start ()
{
restartButton.SetActive(false);
gameOverScoreText.text = "";
scoreText.text = "Score: " + 0;
gameOver = false;
}
void Update()
{
if (gameOver == false)
{
score = Time.timeSinceLevelLoad;
scoreText.text = "Score: " + score.ToString("f2");
}
else
scoreText.text = "";
gameOverScoreText.text = "Score: " + score.ToString("f2");
}