- Home /
Why animation only play first few frames
Hi, I'm trying to animate my character with animator, and until today everything was fine, but something happened, i don't know if it was me or not, when playing animation it shows first 3 frames, then loops around. Everything fine with animations, that were created using "Blend tree", and others just decided to quit working.
pls halp...
So all the animations in the animator are separate and must be linked by conditions. how does it know when to play the jump animation or the run animation?
Can you tell us more about your animator's setup?
Yes, all animations are separate and linked with conditions. For example running animation: "Any state" --> "Running" i got paramater Speed in animator, and in code i link my characters rigidbody2D velocity on x axis to animator parameter "Speed". Then in transition from one state to another i use condition, like Speed | Greater | 0.01 | That means if i my character is moving in any direction animator makes transition and it starts to play animation. But recently my animations fckd up, i tried making new animations + creating new project, but every time it's the same: almost all animations play just 3 or 2 frames then loops.
$$anonymous$$aybe i missed something while creating animations, but i don't know what it is :)
Answer by Merkys · Jun 13, 2014 at 10:51 AM
OK, because i found an answer myself, I'll write it not as comment, so it will be easier to see. For animations to work properly (except which are made by blending tree), transitions mustn't be from "Any state", because that means the state itself. For example if using "Any state" --> "Running" and transition goes with condition that speed is greater then 0.01, when your object tries to move in any direction it plays only first frames of animation, because that animation won't have time to play properly. And that happens because when condition is true animator through transition tells it to play, but transition comes from "Any state", it means from the same animation you try to play, and it goes in cycle never finishing animation.
P.S. if someone need clearer explanation, ask. I'll try my best.
Answer by seanyoncraic · Jun 02, 2015 at 12:59 PM
I fixed this by doing: Open Animator panel - select the transition between Any State and the state that is not playing correctly. Expand Settings in inspector and deselect "Can Transition to Self"
omg thank you, you saved me for not getting a freaking certificate :D
This worked like a charm, though I wish I knew why it worked. I am guessing because we uncheck the box we are saying "if the transition is going go be back to the same animation ignore" so that it can play all the way through. If the box is checked then it interrupts the current animation to go to the next animation, which just happens to be the same one, creating the visual effect of the animation getting stuck on a single frame.
It works because when you are transitioning from Any State to your X state, the condition is always set to true so the animation keeps getting triggered and never gets to play until the end.
Answer by pooja-vincit · Dec 29, 2017 at 06:20 AM
@ seanyoncraic : This worked like wow.. I was so damn frustrated why this is happening :)
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Frames per second not showing,Animation frames not showing 0 Answers
Damn, HOW CAN I KNOW, IF MY 2d ANIMATION SPRITE IS FINISHED??!! 0 Answers
Generic Avatar in Mechanim...not working. 0 Answers
How to play an Animation only once from my MachineState Animator? 2 Answers