public void UpdateDisplay(Unit unit = null) { List <Unit> unitList = FactionManager.GetDeployingUnitList(); int unitID = FactionManager.GetDeployingUnitID(); if (buttonList.Count < unitList.Count) { buttonList.Add(UIButton.Clone(buttonList[0].rootObj, "Button" + (buttonList.Count + 1))); buttonList[buttonList.Count - 1].SetCallback(this.OnHoverButton, this.OnExitButton, this.OnButton, null); } for (int i = 0; i < buttonList.Count; i++) { if (i < unitList.Count) { buttonList[i].imgIcon.sprite = unitList[i].iconSprite; buttonList[i].imgHighlight.enabled = (unitID == i); buttonList[i].rootObj.SetActive(true); } else { buttonList[i].rootObj.SetActive(false); } } butAutoNCom.label.text = FactionManager.IsDeploymentComplete() ? "Complete" : "Auto Deploy"; butAutoNCom.imgHighlight.gameObject.SetActive(FactionManager.IsDeploymentComplete()); lbStatus.text = unitList.Count > 0 ? "Deploying Unit:" : "All Unit Deployed"; }