void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (settingsMenu.IsShowing) { if (settingsMenu.ScrollPos == AutoScroll.ScrollPos.Top) { settingsMenu.Hide(); } else { settingsMenu.GoToTop(); } } else if (saveDialog.gameObject.activeSelf) { saveDialog.OnCancelClicked(); } else if (loadDialog.IsShowing) { loadDialog.OnCancelClicked(); } else { Application.Quit(); } } }