使用如下代码,连续按两次T,动画只会播放一次:
public Animator currentAnimator; void Update() { if(Input.GetKeyDown(KeyCode.T)) { currentAnimator.Play("attack_1"); } }
如果想要可以两次,使用如下代码:
public Animator currentAnimator; void Update() { if(Input.GetKeyDown(KeyCode.T)) { currentAnimator.Play("attack_1",0,0f); } }
未经允许不得转载:第一Unity3D » 解决Unity中Animator使用animator.Play()不能重复播放同一个Animatoin的问题