Best practices > player's God animator vs separate animators?

This might not be a question specific to Unity since it can be more related to a OOP or separation of concerns doubt, but still wanted to know if anyone has faced a situation like this. It probably doesn’t have right or wrong answer either.

My scenario is the following:

  • I have a player prefab which has an animator component and a script attached to it that handles the different transitions for the animator (sets parameters, triggers animation, etc.).

  • The player has skills (like in a Diablo-like game). A skill can be a complex attack which can involve several animations, or events within the same animation. Each of those animations or events can perform different kinds of attack. eg: the first movement does one type of damage and affects some of the player stats, the second attack movement does a different damage and can affect other stats, and so on. So, in essence, each skill can be a compound of abilities, where each ability does a different thing.

Now, the question here is which approach is better, in terms of performance and scalability:

  • to have all the player’s animations (including the skills animations) in one single, God-like animator component associated to the player prefab (maybe with each skill in a different layer)? The player’s controller class will have to call the skill/abilities methods in the Skill class, to actually apply the damage or modify the stat or whatever, whenever an attack skill animation is triggered.

  • to have one animator component for the player for the base animations (idle, walk, run) and one animator per Skill prefab. The advantage of this is better separation of concerns, so that the skill doesn’t have to know anything about the main animator and viceversa. But, I’m not entirely sure about how this could scale or perform, when having dozens of skills (and dozens of animators).

Suggestions?

Thanks.

I believe I’ve asked a similar question relatively recently, although it was more of a Animator vs Animation comparison for achieving the same result. Result being several animations for several weapons, or in your case skills, needing to play different anims depending on what the player has equipped and what their skill loadout is for the equipped weapon.

no need to take notice of the debate, but the advice for using mecanim may be of use to you.

1 Like

“God-like animator vs animator for each objects”
I had to make animations for 60 objects. it seems clear that one animator is better than 60, but I wanted to check.
I generated one animator with one animation, which controlled the movement of 1000 objects in empty project
It spends ~0.7ms in the frame


But 1000 animators spends ~7ms in the frame


Total: God-like animator is better than 1000 animators 10 times for about 1000 objects

1 Like