public void SetUnit(Unit newUnit) { unit = newUnit; if (unit != null) { gameObject.SetActive(true); health.SetAttribute(newUnit.Character.health); mainResource.SetAttribute(newUnit.Character.mainResourse); unitName.text = newUnit.unitName + "-" + newUnit.character.className; } else { gameObject.SetActive(false); health.SetAttribute(null); mainResource.SetAttribute(null); unitName.text = ""; } }