Scriped wont get input

I am Working on a pause menu for my game but it will not get the input i followed all steps from brackeys pause menu video and got no errors but all my player movement is still getting input

here is my script im using i put the Debug.Log in to see if it was picking up the key pressed but nothing

public static bool GameIsPaused = false;

public GameObject pauseMenuUI;

void Update ()
{
if (Input.GetKeyDown(“Escape”))
{
Debug.Log(“Escape pressed”);
if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}
}
}

public void Resume ()
{
Debug.Log(“Game is not paused”);
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}

public void Pause()
{
Debug.Log(“Game is paused”);
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}

You’re sure it’s “Escape” and not “escape”? In any case I recommend never using strings for GetKeyDown. Instead use if (GetKeyDown(KeyCode.Escape)). Then you’ll get autocomplete to choose the right key code, and the compiler will give you a helpful error message if you spell it wrong.

1 Like

Put in an additional debug statement in the Else condition, etc.

Is the UI menu appearing but player input is still going? Or is nothing happening when you hit escape?

Also note you didn’t follow it exactly as he used Keycode.Escape, which is what @kdgalla mentions as well.

1 Like