Hi everyone,
I have a an issue with an in game pause menu I’m making. Currently I can pause the menu and I get the canvas with my UI elements up, one of which is a ‘Continue’ button. I cannot for the life of me figure out how to do this. I am 14 and quite the beginner so a simple answer would be greatly appreciated!
Observed Behaviour:
Pause menu will come up when the ESC button is pressed and the game will pause. When ESC is pressed again, the game will resume. All other buttons in the menu work with the exception of the Continue button.
Expected Behaviour:
When the ESC button is pressed the menu should come up, the game should pause and on click the continue button should continue the game.
Here is the code, line 11 is where it should go.
Canvas canvas;
void Start()
{
canvas = GetComponent<Canvas>();
canvas.enabled = false;
}
void Update()
{
if (//When the button is pressed...)
{
Pause();
}
}
public void Pause()
{
canvas.enabled = !canvas.enabled;
Time.timeScale = Time.timeScale == 0 ? 1 : 0;
}
}