// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Debug.Log("We have entered the patrol state"); walk = animator.gameObject.GetComponent <Walk>(); walk.SetNextPoint(); }