void Update () { if(Input.GetKeyDown(KeyCode.N)){ if(this.GetComponent().isPlaying){ this.GetComponent().Stop(); } this.GetComponent().Play(); } } //this必须有个动画组件。