Wiki

Clone wiki

hydro / Sounds

The Sound Facade

Defines a simple interface to create and play sound instances. It removes the direct dependency from the used audio subsystem, like the Unity built-in one or the FMOD Studio plugin, in scripts that have to manage sounds.

A script that requires the sound subsystem should have component (or take it from an other game object) that implements the SoundFacade interface. An implementation is the FmodSoundFacade that uses the FMOD Studio plugin.

To create a sound, use the array notation, or the Play method to start it directly.

SoundFacade sounds;

Sound sound = sounds["/path/to/sound"];
Sound alreadyStartedSound = sounds.Play("/path/to/sound");

Updated