2017-01-16 183 views
-2

所以我試圖以統一的方式啓動和停止我的步行動畫5.3。如何在Unity 5.3(C#)中啓動/停止動畫

就是這樣。

If(Input.GetKey(KeyCode.RightArrow)){ 
GetComponent<Animator>().Play("WalkAnimation"); 
} 

else If(!Input.GetKey(KeyCode.RightArrow)){ 
GetComponent<Animator>().Stop("WalkAnimation"); 
} 

但不知何故,這對我來說真的沒什麼用。 提前感謝您的幫助。

+4

統一提供各種主題,包括非常好的教程[動畫腳本](https://unity3d.com/learn/tutorials/topics/animation/animator-scripting?playlist=17099) – Hellium

回答

-1

儘管這並不直接回答你的問題,使用直接命令動畫是一個傳統的功能,現在我們使用Mekanim動畫狀態機:

You can find a video tutorial here

+0

如果它不回答問題,請不要回答問題。 –