Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Music and Sound Effects

Yuan Wei Qi edited this page Oct 26, 2017 · 9 revisions

Music

Background music for the main menu and the cut scene is implemented by placing an Audio Source Game Object in the main camera. To play the same music continuously in the main menu, the Audio Source is made to play in a loop.

The background music in the actual levels utilities a Background Music Manager instance class. When a level is first loaded, the instance is created and the music is played. When there is a scene transition, the instance is not destroyed, so that the music plays continuously across scenes. There is a list of scenes that must be provided so that the music only play in those scenes. If the player transition to a scene that is not in the list, this instance destroy itself.

Sound effects

Sound effects were added to the following actions: jumping, picking up items, stepping on/off pressure pad, pulling lever, jumping on snake vine and getting damaged. Due to some bugs in our code, the built game does not have any of the sound effects except the snake vine and the lever (the un-built game of the same version still have all the sound effects).

Apart from the snake vine which its sound effect is manually assigned, all other sound effects are managed by a single static class - the Audio Manager. This class finds all the necessary audio files in the unity project upon start up and stores them. What went wrong was the method to find the audio files; the script uses code from the unity editor, which does not run in the built game. The audio manager is called by the game controller whenever a scene is loaded. It finds the game objects that needs to have sound effects by tag, and then assign the corresponding audio clip to it.

Clone this wiki locally