Cleaner Animators

Hi, just thought I’d share a nice tip about creating cleaner Animators in Unity.

If you have complex animators with a bunch of animation states then your animator can get cluttered really quick. Some animations might also have multiple states in it for example you have a Buff animation that consists of buff_start, buff_loop and buff_end.

Having all 3 of these will make things even messier so to clean it up go into your Animator and right click > Create Sub-State Machine.

A Sub-State Machine allows you to create another Animation tree inside of an animation tree. If you double click on your new Sub-State Machine you can look inside of it. Now you can also add buff_start, buff_loop and buff_end with any transitions that you want and finish it with a transition to (Up) Base Layer. It might look a bit like this
R3zL3Ty

Now in your Base Layer simply create a transition to the sub-state machine like you would for the animation you had there before and voila your Animator probably looks a lot cleaner now.

Mine currently looks like this after applying this method (It’s like 2/5th of the original size):

6 Likes

Thank you for sharing this. This is really helpful :grinning_face_with_smiling_eyes:

Happy to hear that! If any of this is a bit unclear please let me know because I’m not the best at writing up bigger pieces of text haha

1 Like

You nailed it on the head. Great post. You explained it very well :ok_hand:

Good idea, and understandably written.
Is it possible with this new setup to use Animator Override Controller like we do for the “Attack” state?
Right now, I am using this setup:

image

And using AOC to change the animation clips according to weapon / spell.

It’s certainly possible, in fact it’s what I use in my project :slight_smile: In the Animator Override Controller the animations will be listed just like all the others.

Hello, what is AOC? I’d like to know how to change animation clips based on weapon and spell too. Thank you!

AOC is short for Animator Override Controller :slight_smile:

The Animator Override lets us use another animation in place of the one assigned in the Animator. Typically, our WeaponConfig script will have an Animator Override Controller assigned to it which will replace the animations to better fit the weapon.
It’s a little trickier with the Spells, since we don’t know what weapon we’ll be using. What you could do is associate an Animator Override controller with the spell, and after the spell is completed, call the method in fighter associated with the equipment updating (which would reload the correct animator override for the weapon).

1 Like

Personally I have the spell anims in the weapon overrides although I’m not 100% sure if that’s the way to go but in the long run I don’t have to switch out animators before and after every spell so I think it might be slightly better for performance. However I could be wrong here of course.

That’s what I do as well. I also made several cast animation slots, appropriate for different types of casts, and this gives me the variation I need to make each spell look unique.

Privacy & Terms