Prior to Spine 3.5, applying animations at runtime generally required a lot of extra keys to be set at the start of every animation. Now that the new AnimationState in 3.5 solves this problem, we have added a new feature to clean up your animations. Starting in 3.5.38, there is a Clean Up
button when selecting an animation in the tree:
Loading Image
Clicking the button deletes unnecessary keys, ie keys that do not affect how the animation looks. Fewer keys means less data, which is always good, but it can also mean fewer timelines which translates to using less CPU to apply the animation at runtime.
Here's the raptor walk animation before:
Loading Image
And after:
Loading Image
Loading Image
You can select multiple animations and then click Clean Up
to do them all at once. It's easy for a skeleton with a few animations to have thousands of unnecessary keys and hundreds of unnecessary timelines! Here's 22 animations from the 2D Anim Heroes project:
Loading Image
During normal designing of your animations, it's common to end up with some extra keys. Trying to be efficient with your keys in the beginning of a new animation can be painful, so now you can key liberally and use Clean Up
later.
There may be some rare times you don't want to use Clean Up
, such as when not using AnimationState at runtime or maybe if you programmatically find some key and change its value. For most people though, Clean Up
should be used.
Please note: While we have tested it extensively, this is a new feature that deletes keys in your animations. Make a backup before giving it a try, and verify after Clean Up
that your animations still work correctly both in Spine and your applications. :nerd: