//check to see if the android back button (or Esc on computer) has been pressed, and if so, inform the current UI void Update() { if (Input.GetKeyDown(KeyCode.Escape) && CurrentlyShownUI != null) { CurrentlyShownUI.BackKey(); } }