How to combine multiple animations for your main character with mecanim?

I’ve been having trouble figuring out what to search for to find this answer.

Essentially, what I want to do is use mecanim for a 2D character - run, jump, stand, etc. - while having the option of adding items “on top” of that character (a helmet, boots, etc.) at run time based on player power ups. I’m not necessarily trying to reskin the character - more trying to add animations on top of the character.

I’m not sure if child game objects with parallel animations states is the way to go… I’m not sure if there’s a way to control, at run time, which animation layers are shown… In short, I just don’t know how this particular problem tends to be approached.

Does anyone have any suggestions?

Thanks!

Well, in the scene tree any GameObject will move along with its parent GameObject. So for helmet and boots you should be able to just add child GameObjects to the relevant GameObject nodes in your character. You might have to switch off optimisation on the skinned mesh to get the GameObjects to show up, but once you’ve got that you should be able to put the boots etc. in place and just turn them on and off as desired.

That’s assuming that the accessories are pretty rigid, though. If they need to deform along with the character motion then this probably won’t be good enough, and you’ll need to do something a little more advanced to synch up the animations.

Ended up doing this with a combination of “Sync’d animation Layers” and Child Game Objects I could enable / disable.

I did end up manually editing the anim files (YAML) to change the “path” from the root game object to the child game objects.

Unfortunately, with the latest Unity update (4.6.2f1) I can no longer sync animation layers (even though I have Unity Pro).