OnStateEnter
Invoked on the first update frame when a state machine evaluates this state. Implement this message to react to a new state starting.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.AnimationModule
OnStateEnter(Animator, AnimatorStateInfo, int)
Invoked on the first update frame when a state machine evaluates this state. Implement this message to react to a new state starting.
public virtual void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
Parameters
The Animator evaluating this state machine.
The current layer being evaluated.
Remarks
OnStateEnter is invoked when a transition to a state is initiated. It will be invoked after OnStateUpdate of the current state.
Note: OnStateEnter may be invoked multiple times on the same state if that state is synchronized on multiple layers.
OnStateEnter(Animator, AnimatorStateInfo, int, AnimatorControllerPlayable)
Invoked on the first update frame when a state machine evaluates this state. Implement this message to react to a new state starting.
public virtual void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
Parameters
The Animator evaluating this state machine.
The current layer being evaluated.
Remarks
OnStateEnter is invoked when a transition to a state is initiated. It will be invoked after OnStateUpdate of the current state.
Note: OnStateEnter may be invoked multiple times on the same state if that state is synchronized on multiple layers.