public void DeleteUnit() { if (editMenu.unit == null) { return; } Unit u = editMenu.unit; unitList.Remove(u); unitEntries.RemoveAll(un => un.unitScript == u); partyCount--; for (int i = 0; i < partyCount; i++) { unitList[i].number.text = (i + 1).ToString(); } Destroy(u.gameObject); editMenu.Interactable(false); editMenu.Clear(); }