What im trying to do is have an animation to be played when the the left mouse button is clicked. I have already modelled a gun rigged it and added a recoil animation on blender which ive imported into unity, and now i need to script it which i cannot do. I have looked for tutorials for this everywhere but they dont work can anyone help me? I am trying to learn script by the way.
It was surprisingly easy to add an animation to our project.
The animation is part of the model we imported from Maya.
Our model had one animation.
To trigger it, we add a script with code like this to the model in the scene:
function Update ()
{
if ( Input.GetButtonDown("Fire1") ) {
transform.animation.Play();
}
}