public void End() { StopAllCoroutines(); player.GetComponent <BoxCollider2D>().enabled = false; player.GetComponent <Animator>().SetInteger("StateIndex", 2); Button[] buttons = gameCanvas.GetComponentsInChildren <Button>(); foreach (Button but in buttons) { but.enabled = false; } gui.SetUpEndPanel(gameCanvas, checkSprite); }