Book Image

Building Levels in Unity

By : Volodymyr Gerasimov
Book Image

Building Levels in Unity

By: Volodymyr Gerasimov

Overview of this book

Table of Contents (17 chapters)
Building Levels in Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Dealing with Basic Animations
Index

Audio sources and receivers


The way the audio works in Unity is no different from the real life that it's trying to imitate, and it all comes down to collaboration between objects that emit sounds and those that receive them. In Unity, both of them are components, known as Audio Source and Audio Listener. Being components, they can be attached to any GameObject via the Add Component menu in the Inspector window:

Alternatively, you can create an empty GameObject with an audio source or reverb zone by navigating to GameObject | Audio in the top menu.

Note

For future references, we will use the Audio Source created from the top menu.

Audio listener

Unlike the audio source, we already have an Audio Listener present in every scene by default; it's attached to the MainCamera object.

Audio Listener doesn't have any parameters and all it needs to function is to simply exist in the scene. There is, however, one rule that should be followed when dealing with audio listeners:

Note

The Scene always has...