New Mecanim animation features in Unity 5
Unity 5 contains some new awesome possibilities for the Mecanim animation system. Let's look at the new shiny features known in Unity 5.
State machine behavior
Now, you can inherit your classes from StateMachineBehaviour
in order to be able to attach them to your Mecanim animation states. This class has the following very important callbacks:
OnStateEnter
OnStateUpdate
OnStateExit
OnStateMove
OnStateIK
The StateMachineBehaviour
scripts behave like MonoBehaviour
scripts, which you can attach on as many objects as you wish; the same is true for StateMachineBehaviour
. You can use this solution with or without any animation at all.
State machine transition
Unity 5 introduced a new awesome feature for Mecanim animation systems known as state machine transitions in order to construct a higher abstraction level. In addition, entry and exit nodes were created. By these two additional nodes to StateMachine
, you can now branch your start or finish state depending...