public void ShowActionMenu(Agent target) { GameManager.Instance.PauseGame(); panelStack++; ActionMenu.gameObject.SetActive(true); for (int i = 0; i < ActionMenuContainer.childCount; i++) { Destroy(ActionMenuContainer.GetChild(i).gameObject); } foreach (var b in target.possibleBehaviours) { ActionButton btn = Instantiate(actionButton).GetComponent <ActionButton>(); btn.agent = target; btn.behav = b; btn.DisplayText(); btn.transform.parent = ActionMenuContainer; } }