Shooting animation playing for longer than a second?

I have a shooting animation for my player that starts when the player presses “W” but it only lasts for less than a second. I’d like it to last until the animation is completed. Here is my script:

using UnityEngine;
using System.Collections;

public class shootanm : MonoBehaviour {
	protected Animator animator;
	// Use this for initialization
	void Start () {
			animator = GetComponent<Animator>();
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.W)) {
						animator.SetBool ("w", true);
				}
		else {
			animator.SetBool ("w", false);
				}
	}
}

What is your Exit Time set to in the Animator on your transition arrow?
I think it defaults to the length of your animation, in which case your animation might not be long enough? Check in the import settings for the animation :wink:
HTH