Summary

The music player is a script that allow you to manage some basic background music within your games. The script lets you change the track via code with a few transitions to choose from. This script has a static instance by default and is not affected by the main Audio Manager static instance toggle.
Setup
The inspector for this script should be setup with the first track you wish to play, the rest of the tracks should be stored in your own scripting to be inserted into the player when needed. You set the track you wish to play in the inspector first & then configure the rest of the inspector for that track. The rest of the music player usage is via code.
Inspector Breakdown
Setting | Description |
---|---|
Track To Play | The track that will play when will script is first called |
Music Audio Mixer | The audio mixer to play the clip from |
Play On Awake | Should the click play on the Awake() method |
Intro Transition | The transition the player uses when the track first plays |
Transition Length | The length of the transition for changing tracks |
Track Volume | Edits the volume of the clip between 0-1 |
Track Pitch | Edits the pitch of the track |
Should Loop Track | Should the track loop once it reaches the end of the audio clip The looping of the track you select is optional, should you want to use it you’ll need to set it up for each track you want to use. When calling to play a track in code you can set the start and end |
Start Track At | The time in seconds where the clip should start from |
Loop Track At | The point in seconds where the track will loop from |