void Start() { healthScript = transform.root.GetComponent <AIHealthMana> (); healthScript.SetHealthbar(gameObject); //Store the actual character character = transform.parent; //Set the actual parent to be the canvas; if it stayed with the character //it would wiggle all over transform.SetParent(GameObject.Find("EnemyHealthCanvas").transform); slider = GetComponentInChildren <Slider> (); text = GetComponentInChildren <Text> (); text.text = charName; }
void Start() { healthScript = transform.root.GetComponent<AIHealthMana> (); healthScript.SetHealthbar (gameObject); //Store the actual character character = transform.parent; //Set the actual parent to be the canvas; if it stayed with the character //it would wiggle all over transform.SetParent (GameObject.Find ("EnemyHealthCanvas").transform); slider = GetComponentInChildren<Slider> (); text = GetComponentInChildren<Text> (); text.text = charName; }