GetKeyDown(KeyCode.Escape) doesn't work

public class EscMenu : MonoBehaviour {

private GameObject menu;
// Use this for initialization
void Start () {
	menu = GameObject.FindGameObjectWithTag ("Menu");
	menu.SetActive (false);
}

// Update is called once per frame
void Update () {
	if (Input.GetKeyDown (KeyCode.Escape)) {
		Debug.Log ("escape");
		menu.SetActive (true);
	}
}

For some reason, the if statement in Update() doesn’t run when I press the Escape button. There are no compile errors. “escape” doesn’t work, nor does the menu panel turn on.

Your “if” statement looks good. I have been able to use the escape key ok in editor as well as build. Put a Debug.Log statement before the “if” section to check if the update() is actually running. Perhaps you have the script disabled on the gameobject.

If the script you are executing is inside the game object that is tagged as “Menu”, the code won’t execute because you de activated it. If it is not, try to do what Foulcloud said.