- Home /
No pausing when game over occurs
Hello I have a pausing script whenever the game is disturbed
public static bool isPaused;
public GameObject pauseMenuUI;
void Start()
{
isPaused = false;
Time.timeScale = 1;
pausedMenuUI.SetActive(false);
}
public void GamePause()
{
isPaused = !isPaused;
if (isPaused)
Time.timeScale = 0;
pauseMenuUI.SetActive(true);
if (!isPaused)
Time.timeScale = 1;
}
void OnApplicationPause ()
{
pauseMenuUI.SetActive(true);
isPaused = true;
Time.timeScale = 0;
}
public void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1;
isPaused = false;
}
but I don’t want to pause or have the pause menu to occur when the game over menu comes up
void PlayExplosion()
{
GameObject explosion = (GameObject)Instantiate(ExplosionGo);
explosion.transform.position = transform.position;
gameOverText.SetActive(true);
restartButton.SetActive(true);
MenuButton.SetActive(true);
{
I need help with not having the pause menu to come up when it’s game over.
Answer by AdityaViaxor · Jul 31, 2018 at 05:43 AM
Hello I think the real bug is in onApplicationPause otherwise your code seems ok as far as i see onApplicationpause call when you make timeScale to zero and same thing may be happen when player dies time will gets zero bcz you havent set pause menu true from anywhere else except onApplicationPause. So try and Debug onApplicationPause if on player die the Debug gets called you will understand the bug.
Your answer
Follow this Question
Related Questions
Pausing Music 1 Answer
Multiple Cars not working 1 Answer
Reset the velocity after the game has unpaused C# 2D 1 Answer
Distribute terrain in zones 3 Answers
Pause System not working :/ 2 Answers