Book Image

OUYA Game Development by Example

By : John Donovan
Book Image

OUYA Game Development by Example

By: John Donovan

Overview of this book

The OUYA console and development kit gives you the power to publish video games for the players, creating a console marketplace of the gamers, for the gamers, and by the gamers. Using the OUYA developer kit and the Unity3D game engine, even beginners with a captivating game idea can bring it to life with a hint of imagination. OUYA Game Development by Example uses a series of feature-based, step-by-step tutorials that teach beginners how to integrate essential elements into a game engine and then combine them to form a polished gaming experience.
Table of Contents (18 chapters)
OUYA Game Development by Example Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding audio to your game


No game is complete without audio, and fortunately it's relatively simple to integrate in Unity. In this tutorial, we'll demonstrate how to add audio to your Unity project by creating a sound effect that plays whenever a coin is collected. Perform the following steps to add audio:

  1. Click on your Coin prefab in the Project window to display its properties in the Inspector window.

  2. Click on the Add Component button in the Inspector window and select Audio Source from the Audio menu.

    The Audio Source component has several properties that can be set in the Inspector window, as shown in the following screenshot:

    The Audio Clip region is where you'll add the sound effect file that you want to play.

    The Play On Awake checkbox, which is enabled by default, dictates whether the Audio Source component plays Audio Clip as soon as it's created.

  3. We only want the coin's Audio Clip to play when it's collected, so uncheck the box next to Play On Awake.

    Before you add in...