关于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);
    }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM