Mecanim Animation Bridge - 2D With Transitions

The Mecanim 2D with Transitions animation bridge plays 2D animations when animation state changes and has the option to play transition animations: animations that are played when moving from one state to another.

As an example you could create a landing animation by playing a new animation between the state FALL and the state IDLE.

It supports:

  • Directly Playing animations without transitions.
  • Simple animation priority (higher priority animations must play to completion before lower priority animations play)
  • Animator Overrides
  • Transition animations which play between one state and another.

 Warning: The Mecanim 2D animation bridge with transitions requires all states supported by your character have matching states in the Mecanim Animator (animation state tree). These names must be an exact upper-case match with the state name.

 

A sample Mecanim 2D with Transitions animation state machine, notice the states like CROUCH_TO_IDLE which includes a transition to the IDLE movement: 

 

Quick Start

In the quick start we will set up a landing animation which occurs when character goes from the FALL state to the IDLE state or when the go from the FALL state to the WALK state.

Note: The steps assume you have a landing animation ready.

Steps:

  1. Set up a 2D animator following the instructions from the Quick Start section of the 2D Bridge.
  2. Add new states to your animator called: FALL_TO_WALK and FALL_TO_IDLE.
  3. Add your landing animation to these states.
  4. Add a transition from FALL_TO_WALK to WALK with an exit time of 1 (see screenshot below).
  5. Add a transition from FALL_TO_IDLE to IDLE with an exit time of 1.
  6. Go to your bridge and add 2 Transitions one for FALL to WALK and one for FALL to IDLE (see screenshot below).
  7. Press play and you should now have a landing animation.

Transition with exit time 1:

 

Bridge with two Transitions:

 

Required Components

 In order for the Mecanim 2D with Transitions animation bridge to animate it requires:

  • An Animator component.
  • A SpriteRenderer or MeshRenderer or SkinnedMeshRenderer (and associated components).

 

Configuration

The Mecanim 2D with Transitions animation bridge relies on an Animation Controller with animation state names being the same the AnimationState enum. This means the state name should be an exact match with capital letters, for example: WALK or AIRBORNE.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk