I have a very similar problem to Maggatron’s question in that I’m following Brackey’s Tutorials and my pause menu buttons do not highlight or click - I added Debug.Log lines to each method in the PauseMenu script to watch for in the console, but only the keypress to open or close the pause menu does anything in the console. In my case, the Main Menu works perfectly, including transitioning to an options menu and back to main, but once I load the game, I can pause and unpause with the key I script it to (and can change that key and have the same behavior on any other key in case it was because of using the escape key that frees the mouse) but cannot highlight or click any of the buttons. I do have an EventSystem file just like seen in Brackey’s video and mentioned on Maggatron’s thread. The panel is a child of the canvas, and the buttons children of the panel.
Here is the script for my main menu that works as I expect:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void EnterGame()
{
SceneManager.LoadScene(1);
}
public void QuitGame()
{
Application.Quit();
}
}
And here is the script for the Pause Menu that isn’t working correctly. Any advice on where to look is most welcome:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public static bool SceneIsPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("p"))
// if (Input.GetKeyDown(KeyCode.Escape))
{
if (SceneIsPaused)
{Resume(); }
else {Pause(); }
}
}
public void Resume()
{
Debug.Log("Resuming");
pauseMenuUI.SetActive(false);
Time.timeScale = 1;
SceneIsPaused = false;
}
public void Pause()
{
Debug.Log("Pausing");
pauseMenuUI.SetActive(true);
Time.timeScale = 0;
SceneIsPaused = true;
}
public void Menu()
{
Debug.Log("Menu Button");
Time.timeScale = 1;
SceneIsPaused = false;
SceneManager.LoadScene("Menu");
}
public void QuitGame()
{
Debug.Log("Quit Button");
Application.Quit();
}
}