I have trouble with trying to smoothen out transition from the last and the first frames of 2D animation that I made in Unity.
Unity simply starts animation over once it ends.
I tried some old tricks that I knew, such as making position of legs that I’m animating have same position and rotation in last and first frame, but this also creates mini delay when animation plays and is visible and gives away “jagged” effect.
Is there a way to make Unity loop animation but instead of starting it over, loop from last to first frame ?
I tried pose loop from Inspector, it didn’t help much.
If you click on the .anim asset then switch the inspector to debug mode you can set the animation’s type (legacy or mecanim), and the wrap mode. Set it to Once or Loop and it will think of the first frame as the end. Clamp or PingPong will think of the last frame as the end.
I highly recommend using legacy animations for 2D. Mecanim transitions will wreak havoc on your sprite frames.
Before you set the last keyframe in your animation, select the very first keyframe. Now scroll to where you want your last keyframe (The one that should look like the first keyframe) and right click add the top and press add keyframe. This should copy the current animations position and duplicate it.
This is the workaround I am using.
Set tangents of first and last keys to linear.
- In animation window, go to Curves tab.
- Right-click the last key, set left tangent to linear.
- Right-click the first key, set right tangent to linear.