关于Unity中的Animator使用animator.Play()不能重复播放同一个Animatoin的解决方案

使用如下代码,连续按两次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);
    }
}

posted on 2016-02-23 16:22  陈二狗  阅读(11797)  评论(0编辑  收藏  举报

导航