O'Reilly logo

Unity 5.x Animation Cookbook by Maciej Szcześnik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To use behaviors with Mecanim states, follow these steps:

  1. First we need to prepare the example scene. Create a Cube in the scene.
  2. Create two lights and name them Light1 and Light2. Place them near the cube so you can see their effect.
  3. Create an empty game object and name it Controller.
  4. Create a new Animator Controller and name it LogicController.
  5. Add an Animator component to the Controller game object and assign the LogicController to it.
  6. Open the LogicController.
  7. Create an empty state and name it NoBehaviors. Make it the default state.
  8. Create a Trigger parameter and name it Switch.
  9. Create four empty states and name them Light1RandomWaitAndSwitchLight2Random, and RotateObject.
  1. Create the following listed transitions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required