// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Escape)) { if (planes == true) { manager pum = GameObject.FindObjectOfType(typeof(manager)) as manager; pum.HidePlanes(); } if (otherGames == true) { planeSelecter pum = GameObject.FindObjectOfType(typeof(planeSelecter)) as planeSelecter; pum.closeOtherGames(); } } }