// 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) { if (m_rigidbody2D == null) { m_rigidbody2D = animator.transform.root.GetComponent <Rigidbody2D>(); } if (m_crowdControlManager == null) { m_crowdControlManager = animator.transform.root.GetComponent <PlayerCrowdControlManager>(); } m_rigidbody2D.velocity = new Vector2(0, 0); m_crowdControlManager.Stiffen(stiffenTime); }