[Unity][Animation&Animator]设置Animator状态机动作播放速度


状态机Attack 的Motion 动作为Attack 的Speed的 Parameter要勾选,并设置 变量。


一般在 Start函数里面获得Animator组件

        animator = =GetComponent<Animator>();//获得当前挂载脚本的 物体 的 Animator组件
        animator = GetComponentInChildren<Animator>();//获得当前挂载脚本的 子物体 中的第一个有 的 Animator组件 的物体的 Animator组件


animator.SetFloat("AttackSpeed", 2.0f);//设置 状态机Attack 的Motion 动作为Attack 的攻击速度的参数为 AttackSpeed。 攻击速度的参数 AttackSpeed  为浮点变量float。


相关文章:

  • 2021-09-05
  • 2021-08-04
  • 2021-12-28
  • 2022-12-23
  • 2021-11-04
  • 2021-11-20
  • 2021-03-27
  • 2021-11-29
猜你喜欢
  • 2021-04-13
  • 2021-11-29
  • 2021-06-14
  • 2021-11-29
  • 2021-06-25
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案