關於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