当前位置:   article > 正文

Unity的动画重新播放/暂停/继续播放(Animation/Animator)_unity animation从头播

unity animation从头播

一. 重新播放

Animator.Play(state, layer, normalizedTime)
  • 1

normalizedTime为零时就可以做到重播的效果

layer是从0开始的
比如有一个叫“hit”的动画,在layer 0层中

animator.Play("hit", 0, 0f);
  • 1

二. 暂停和继续播放

1. Animotor
// 播放
animator.Play("ani_name");
// 暂停
animator.speed = 0;
// 继续播放
animator.speed = 1;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
2. Animation
// 播放
animition.Play("ani_name");
// 暂停
animition["ani_name"].speed = 0;
// 继续播放
animition["ani_name"].speed = 1;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/633452
推荐阅读
相关标签
  

闽ICP备14008679号