2
\$\begingroup\$

I am making a 2D game with Unity 5.4 and I want to animate my 2D human character.

He has different sprites for its body parts - leg(s), hand(s), head, eye(s), nose, mouth. Its eyes, hands, legs move independently from each other - meaning their animations and transitions are not related in any way.

My question is, which alternative is the better choice performance-wise when animating?

  1. For legs, hands, eyes, etc. create separate Animator and animate them separately.

  2. For all animations use single Animator (attached on body's "container" GameObject) and create for legs | hands | eyes different Layers in the Animator.

\$\endgroup\$
  • 1
    \$\begingroup\$ Unity provides a very good profiler. For a practical approach you could compare both alternatives by profiling them. \$\endgroup\$ – Artery Dec 13 '16 at 15:22
1
\$\begingroup\$

I'm not 100% sure with Unity, but in my experience with C++ and lower level stuff, combining them into a single animator should be more efficient than having four of them doing their own thing. The higher level you get, the more "bookkeeping" stuff there tends to be, so having more animators will just waste more processing cycles on stuff the other animators have already done, or will do again.

That being said, I doubt there'd be much difference either way. Unity's pretty decent on performance, especially for 2D games. I wouldn't worry too much about framerate until it's done, and if it runs acceptably and it's easy to maintain, then score! If not, it's easier to profile and find what's slowing you down.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.