文档

Unity Engine

Unity Engine

OnStateEnter

Invoked on the first update frame when a state machine evaluates this state. Implement this message to react to a new state starting.
阅读时间1 分钟最后更新于 1 个月前

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

animator

The Animator evaluating this state machine.


layerIndex

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

animator

The Animator evaluating this state machine.


layerIndex

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.