- Home /
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);
}
}
}
Answer by husbandofemily · Dec 11, 2014 at 03:15 AM
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 ;-) HTH
That did help thank you! However now the animation plays very delayed and doesn't match up very well to when I press W, do you know why? D:
Your answer
Follow this Question
Related Questions
How can I change my AnimatorState instantly? 1 Answer
Invalid Layer Index? 1 Answer
Animation Running Game 0 Answers
animation blending error (Animator Unity4) 0 Answers
How to get reference to a specific Animation Clip in Animator. 0 Answers