标签:
首先这个脚本必须继承自StateMachineBehaviour
public class MySMB : StateMachineBehaviour { public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); Debug.Log("!!!"); } }
然后切到Animator面板,选择状态机里的任意状态,点击Add Behaviour即可挂载
这时运行游戏,当状态机运行至Jump状态时,程序打出Log
Unity-Animator零散记录5 StateMachineBehaviour状态机脚本学习
标签:
原文地址:http://www.cnblogs.com/hont/p/5093334.html