- Home /
Animation is not playing all frames
Hi.
I'm animating a 2D character using a sprite sheet to practice the software. I'm having a problem tho, i use an Animator with two vars : a moving boolean and a direction integer (see attached) and this snippet :
void Update () {
Animator anim = GetComponent<Animator>();
if (Input.GetAxis ("Horizontal") == 0 && Input.GetAxis ("Vertical") == 0) {
anim.SetBool ("moving", false);
} else if(Input.GetAxis("Horizontal") > 0) {
anim.SetBool("moving", true);-
anim.SetInteger("direction", 2);
} else....
}
When i run this, the character is moving, but only the first one or two sprites of each animations (which contains 8 each) are played, not the others. I believe the problem is that animation start before the previous end, but i have no idea how to control this.
Plus (another problem), when i release the right arrow (for example), the animation keeps playing for about a second, and stop instated of stopping instantly when i release the key.
Thanks for reading.
Attached:
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Dynamic way to adjust animated sprite length 0 Answers
Animator State Freezing 0 Answers
How to optimize 2D Animations created with 2D Animation packege? (v3.1.1) 0 Answers
Animator behaviour on GameObject 1 Answer