Play animation on MouseButtonDown

Hello, very new to unity and need help with a bit of coding.

I have an animation attached to an object that I want to play when I click my left mouse button but I cant figure out the code. All help would be really appreciated.

The animation is called M9 Anim and the object is called M9

All help would be really appreciated.

Make an animation controller and make a transition between anystate and your animation. Make a animator bool. Setup left mouse button in Input Manager. Make a condition if your bool is true to transition. Uncheck Has Exit time. Add a script to your player with something like this in: void Update() {bool walk = Input.GetKey(“leftmousebutton”);
anim.SetBool(“Walking”, walk); }

Here’s a tutorial on Animation: Unity Connect

Hope this helps