I'd like the restart-button to work after the game, not only during the game. The button is there (visible) during the game, but it only works during the game. Whenever "gameOn is false, the button stops working. I just learning how to write code, so I'm sorry if this is too obvious.
I've tried to make the RestartGame() an if-statement.
public void GameOver()
{
gameOn = false;
gameOverText.gameObject.SetActive(true);
restartButton.gameObject.SetActive(true);
}
public void RestartGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
It's possible to restart the game during game play, but not after the game is over.