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);
}
}
}