My question is: if you have several animator controllers for one object, how would you organize the code? I guess it this case it doesn’t matter if you’re using mecanim or doing all the animation through code. Also combining all the animations into one controller isn’t really an option.
Here’s a long list of details:
I need to import animations from Spriter, usually there are 3 files:
- anim.bin (animations)
- atlas.tex (all the textures)
- build.bin (not quite sure, I guess it contains info for the textures, like pivot points and so on)
Most objects have all 3 files and it works quite well, but some animations (characters for example) have ATLAS and BUILD in one archive and lots of archives with separate ANIMATIONS, like idle, running, attacking, etc.
First step is to unpack it, then it looks like this:
- folders with textures
- .scml file (a Spriter project which I can open and mess with it)
The next step is to import it to Unity (with Spriter2UnityDX importer) and here’s what it looks like in Unity:
- folders with textures
- animation controller
- a prefab which contains list of animations
So as you may guess when it comes to importing files with SEPARATE animations, it creates an animation controller and a prefab for EVERY set of animations.
Here’s how I tried to put all the animations into one animation controller:
- The most obvious thing is to copy an animation from one prefab to another, but every animation set uses different textures (only the ones it needs) and in different order. So copy pasting an animation into different controller messes it up big time.
- Merging projects in Spriter. Doesn’t help, still creates separate controllers when imported to Unity.
Here’s what I was thinking of but haven’t tried:
- Somehow create (in Spriter) universal set of textures (and in the same order) so every animation uses it. First of all I’ve no idea if it’s even possible, since the animations are quite complex (there’s z-order, sprites change within animations, so a hand becomes a fist and so on). Basically I don’t know how to approach this.
- Create a proper skeletal animation in Unity and recreate every animation using Spriter as a visual template. Now this will probably take 20 years, even if you’re an animator. And I’m not.
So it leaves me with multiple animator controllers and brings back my initial question. If you’ve read it all and have an idea/suggestion how to deal with his mess, any help is appreciated.