Trouble Navigating Pause Menu....
I have a pause menu with "Resume", "Main Menu", and "Restart Level". They all work as they should, however if I click on "Main Menu" or "Restart Level" I run into some issues. The issue with the "Main Menu" is that, when I am at my menu after navigating there from the pause menu, and I click on start. It takes me back to where I left off rather than restarting the game. My guess is that it has something to do with "TIme". The second problem I have with "Main Menu" is shared with "Restart Level". When I click them once... I can't click on them again. Nothing shows on Console and Inspector seems to be as it should. Any Ideas? Would it have to do with my SceneManager? I'll post my scene manager script as well.
Here's my script. using UnityEngine;
public class PauseMenu_Controller : MonoBehaviour { [SerializeField] private GameObject pauseMenuUI; [SerializeField] static bool isPaused = false;
public void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (isPaused)
{
DeactivateMenu();
}
else
{
ActivateMenu();
}
}
}
public void DeactivateMenu()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
isPaused = false;
AudioListener.pause = false;
}
public void ActivateMenu()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
isPaused = true;
AudioListener.pause = true;
}
}
This is what "Restart Level" and "Main Menu" call...… public void Restart() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
public void LoadStartMenu() { SceneManager.LoadScene(1); }
Also from Main Menu To Start game... public void StartGame() { SceneManager.LoadScene(3); }
I'm about 2 months into Unity and C# and this is my first project on my own so please go easy on me lol
Your answer
Follow this Question
Related Questions
Game Clock (Like in "The Escapist") 1 Answer
Change Camera Position when pressing a button whilst changing scenes 1 Answer
Why is the private int variable in this c# program not updating? 1 Answer
Going back to MainMenu from other level. (Problem) 0 Answers
How to measure the amount of time it takes for unity to compile (To compensate Mathematically) 2 Answers