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?

alt text

try setting keys at frame #39, then delete the keys at frame 40 making it a 39 frame loop.

In Unity 2022, it looks like the extra frame has been removed, which I would find convenient but I’m fearing that it would affect all existing animations. Check updates on this thread: https://forum.unity.com/threads/animation-last-keyframe-does-not-add-extra-frame-anymore.1325568/