[Unity2D] How best to manage having many different animations for a single GameObject

About Me

  • New to Unity.
  • Experienced in creating a fighting game.
  • C# developer by trade.

The Basis:

I am making a fighting game with rather complex characters. Think Super Smash Bros (ignore the pony…) with 2D sprites. Think of all the different animations a single character would need. (Walk, Run, Jump, 10+ Attacks, 5+ Specials, Hurt, Smashed, Grabbed etc etc). I want to try to make this as simple, clean and organized as possible.

My Thought

The following picture is the closest solution I’ve gotten to, but it’s flawed. Using a Blend Tree, I would hold all the animations of a kind (such as “Attacks”) in a make-shift array and using the parameter “AttackID” I could fetch the animation I would like.

But again, it is flawed. The Exit Time, for example, must be the same for every animation, which is far from ideal if I am to have any variety in Attacks for the game.


A Better Alternative Anyone?

Does anyone have any experience with handling a ton of different animations for a single character?
Any ideas on what I can try?

Thank you in advance,


Edit (3 Hours later):

Realized that there is a Animator.Play() function. I can manually (programmatically) handle these many animations rather than rely on the automated system. More details as things progress.

Edit #2

Using animator.CrossFade(“AnimationStateName”,0f,-1,0f);. Full answer below.

(Sorry for answering my own question but…)


Using this line (including the number arguments), I am able to switch animation states programmatically, interrupting the current animation state in the process. Animations go to Idle via Exit Time 1.00 and no longer require an “Attack” trigger or “AttackID” int parameter.

The Animator State Machine will be a bit cluttered (especially without the ability to zoom out) but that appears to be the price of complexity.

I do hope this helps someone,