Sound Manager

Author: Tom Vogt (tom@lemuria.org)

Description
Two scripts I use to add a bit of dynamic music. The first script takes a list of songs and will play through them, repeating with the first when he reaches the last one. The second script allows interruption of the background music with event-driven clips, after which the background music will continue.

Usage
You need 3 game objects for the first script:
 * Music Manager
 * Source 1
 * Source 2

The two sources need an audio source component attached. Everything else will be handled by the script. Attach it to the Music Manager gameobject, drag the two source gameobjects into the slots for Source 1 and Source 2 and your music clips into the array for soundtracks.

The second script should be attached to a collider object with the collider set to trigger. This trigger defines the area where the interrupt will occur. Make it large enough, because if the player leaves the area, the interrupt music will end. One way or the other, it will only play once. It should be easy to modify the script so that it either loops, or does not end upon leaving.