2017-01-16 184 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

如果它不回答问题,请不要回答问题。 –