// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("Creating Health Bar"); //create a health bar for this object PetUtility.CreateHealthBar(animator.gameObject.GetComponent <UnitBehaviour>()); EventManager.TriggerEvent(ParameterizedGameEvent.unitRespawn, animator.GetComponent <UnitBehaviour>()); }