How to do it...

To play cutscenes during gameplay, follow these steps:

  1. Import your cutscene. Make sure to import the character animation as a separate file.
  2. Go to the cutscene asset's Import SettingsAnimation tab.
  3. Rename the Default Take animation to Cutscene.
  4. Create a new Animation Clip, choose the Default Take as the source, and set the Start frame to 0 and the End frame to 1. Call this animation CutsceneIdle and make it loop.
  5. Place the cutscene game object (in our example this is the Ball game object) and the character in the scene.
  6. Follow the Using root motion to steer a character recipe from Chapter 4Character Movement. This way, you will have a moving character you can control.
  7. Create an Animator Controller for the cutscene.

Get Unity 5.x Animation Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.