思路

通过记录当前播放位置,来实现动画的暂停播放。

    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Space) && !pause)
        {
            //Take 001 为动画的名称
            pauseTime = animation["Take 001"].time;//记录当前播放位置
            animation.Stop();//停止播放动画
            pause = !pause;
        }
        else if (Input.GetKeyUp(KeyCode.Space) && pause)
        {
            //Take 001 为动画的名称
            animation["Take 001"].time = pauseTime;//设置播放位置
            animation.Play("Take 001");//开始播放动画
            pause = !pause;
        }
    }

出现问题

MissingComponentException: There is no ‘Animation’ attached to the “Player” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “Player”. Or your script needs to check if the component is attached before using it.

解决方法

只需要将u3d里模型的Rig->Animationtype 设置成Legacy。
QQ截图20160327160415.png