public void CreateHealthBar(HealthComponent health) { UI_HealthBar healthBar = Instantiate(Prefab, transform); healthBar.gameObject.name = string.Format("Health Bar ({0})", health.gameObject.name); healthBar.HealthObj = health; UI_Follow follow = healthBar.GetComponent <UI_Follow>(); follow.Target = health.transform; }
private void Awake() { uiHealthBar = FindObjectOfType <UI_HealthBar>().GetComponent <UI_HealthBar>(); }