- Home /
Looping animation - Last keyframe adds extra frame
I'm trying to create a simple sprite based walking animation for my 2D character. Now I'm struggling with Unity's keyframe animation system.
As far as I understand, I have to copy the first keyframe at the end of the animation to make it loop correctly (which is weird already; I wish I could just set the length of the fourth keyframe to be as long as the others).
But if I add a copy of the first keyframe at the end, Unity adds an extra frame for it. This means the first keyframe is effectively one frame longer than all the others on each loop, and the whole animation has 41 frames instead of 40.
So, am I doing something wrong or misunderstand something here, or what can I do to get rid of that extra frame?
TL;DR: There is this extra frame in my looping animation; how can I get rid of it?
Answer by shadowpuppet · May 01, 2020 at 02:03 PM
try setting keys at frame #39, then delete the keys at frame 40 making it a 39 frame loop.
Yeah, I ended up doing that, so I guess that's the way to do it. It still feels more like a workaround to me. But thank you anyway :)
Well, not really a workaround. As an animator for a game company for over 12 years that is just the way to go . Do a looping animation having the first and last frames identical, say frame #0 and frame #40, then go back one frame from the end and make that the new ending - #39. Otherwise, you will be playing that same pose twice, frame #0 and frame #40. At 60 FPS which is what the rate was for AAA game animation, a double pose is barely noticeable. But @30 fps animation you can spot a hiccup - especially on a short loop like a walk or a run
It's worth noting that ending at frame 39 makes it a 40 frame loop because we are counting 0.
Your answer
Follow this Question
Related Questions
Animation frame size workaround? 0 Answers
Using mask in Mecanim 1 Answer
Compile error with animator 1 Answer
2D Sprite animation - How do I jump to the next frame? 0 Answers
How can I make the animation timeline more intuitive ? 0 Answers