C-Sharp Animation.play() not working

so i want to press E and play a animation so when i enter the animation.play() it says parsing error.is there any other way to play animations in c#?code:
using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {
function Update(){
if(Input.GetKeyDown(“e”)){
animation.Play(“jump”);
}
}

It’s

using UnityEngine; 
using System.Collections;

public class NewBehaviourScript : MonoBehaviour { 


     private Animation animation;

     void Start() {
          animation = GetComponent<Animation>();
     }
     function Update(){ 
          if(Input.GetKeyDown("e")){ 
               animation.Play("jump"); 
          } 
     }
}

Get your syntax right and the error will disappear :slight_smile: You are missing one “}” at the end of your script.

Animation.Play

Also, please properly format your code (with the 101010 button).

There is another way to play animations, which is using Mechanim, which uses a statemachine and the new Animation component. Check the User Manual.