public void BackButtonActions() { int sceneID = SceneManager.GetActiveScene().buildIndex; // get active scene // if not start scene => load home (from grids and shop) if (sceneID != 0) { SceneManager.LoadScene(0); } else if (sceneID == 0 && showPanels.isMenuOpen) { // QuitApplication is appended to this go gameObject.GetComponent <QuitApplication>().Quit(); Debug.Log("quit time"); } else { // on start go back to main menu showPanels.HideOptionsPanel(); showPanels.HideStylePanel(); showPanels.HideCustomPanel(); showPanels.ShowMenu(); } }