Animation on mouse click.

Hi all,

I’m pretty new to these forums and new to Unity altogether so if anything I say seems stupid please just let it slide :stuck_out_tongue:

Basically, I’m doing a Games Design course at University and our first project is to design a zombie game. I have made models and animated them with little problem. But I have encountered a problem trying to play an animation on clicking the mouse. The animation itself is the pumping of a shotgun. It plays when first exported into Unity (With no script attatched) so I know the animations there. But when I try to attatch a script I get nothing. I tried some different scripts I found online but still no joy.

So the script I’ve tried most recently was:

function Update ()
{
if (Input.GetButtonDown(“Fire1”)) //check to see if the left mouse was pushed.
{
animation.Play(); // if pushed play the animation.
}
}

Dont know if thats incredibly wrong or not, but any help would be greatly appreciated.

Hey man, not sure if your still trying at this our what, but I’m pretty sure you gotta type what animation you want to play…I’d write you a quick example but I’m till learning this stuff myself, that’s how I found your thread :stuck_out_tongue: