Unity has provided a built-in state machine editor for managing animations since version 4. This is the officially recommended approach to animating a game character. However, it often leads to game logic being divided between code and the animator state machine. I would prefer to have all my game logic in one place, to simplify development and debugging. Moreover, in some cases — especially simple 2D sprite games — the Animator can seem like more trouble than it's worth.
To help clarify the pros and cons, I built a 2D game character using three different approaches:
- A simple home-grown animation system that eschews Unity's built-in animation support completely.
- Use of Unity animations, but without using the Animator state machine; instead each animation is invoked directly from code.
- Full use of the built-in Unity components, with all game logic in the state machine, and only minimal supporting code.
For the rest of the story, see the full article on Gamasutra!