Implementing Spine animations in Unity
I’d said before that I’m going to use Spine for the 2D projects in my latest book, and this month I’ve been making tons of progress on that. I’ve pretty much finished all the chapters about 3D characters for my book on character customization and now I’m starting to work on the section of my book that covers 2D characters.
The first step was creating the images to animate, and for that I used Krita. Krita is just generally my image editor of choice, but it has a layers export tool that is extremely useful for preparing images to use in Spine. It’s fairly natural to put every part of a character on a separate layer, and this exporter will save each layer as an individual image.
I then animated the character in Spine. This tutorial series got me up to speed real quick, so I recommend it but with an important caveat: it’s a great Spine explanation for someone who already knows how to animate on computers, but I’m not sure it’s the best for someone who is completely new to animating. For example, the first video is a tour around the interface. Showing where the dope sheet is located is great for someone like me, but if you don’t already know what a dope sheet is then your reaction would be “um, okay?”
Anyway, after animating in Spine I then exported the character and loaded it in Unity. Spine provides a runtime for importing and controlling the animation, so I had to install that runtime. With that installed, actually importing the character was a snap:

At this point I did a lot of fiddly trial-and-error going back and forth between Spine and Unity, in order to adjust the character’s rig for my needs. For example, Spine supports the concept of “skins” for customizing which images attach to which bones, and I needed to adjust the character’s skeleton to accommodate these skins. The resulting setup allows the character’s cloak to be removed, the horns to be removed, or even completely swapping the colors:



Similarly, while Spine defaulted to version 4.2 (which is the latest stable version) I switched to 4.3 (the latest beta version) in order to use the new on-demand loading functionality.
My publisher has already indicated they will provide new images for the character (I guess they don’t think it looks good in marketing screenshots) so the final character in the book might look different. Even with new images though it’ll still be the animations I created, plus the skin setup will stay the same.
Discussion