How to do it...

To change the pitch of an audio clip according to the speed of an animated object, please follow these steps:

  1. Create a new Unity 3D project.
  2. Create a new Models folder in the Project panel, and into this import the provided animatedRocket.fbx file.
  3. Create a new Sounds folder in the Project panel, and into this Import the provided audio clip, engineSound.wav.
  4. Select the animatedRocket file in the Project panel. In the Inspector for animatedRocket Import Settings, click the Animations button. In Animations select (the only) Take 001 clip, and make sure to check the Loop Time option. Click on the Apply button to save the changes. See the screenshot for these settings:
The reason we didn't need to check Loop Pose option is ...

Get Unity 2018 Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.