Inspector Variables

FieldTypeDefaultDescription
musicSourceAudioSourceThe AudioSource component used for playback. Must be assigned on the prefab.
musicClipAudioClipThe music clip for this scene's manager to play.
transitionDurationfloat1Duration in seconds of the volume crossfade between two different tracks.

Static Properties

PropertyTypeDescription
currentMusicManagerThe active singleton instance.

Crossfade Behaviour on Scene Load

ConditionResult
No existing MusicManagerNew manager becomes singleton, calls DontDestroyOnLoad, and starts playing immediately.
Same clip already playingNew manager is destroyed. Music continues uninterrupted.
Different clip playingCrossfade (transitionDuration seconds) starts on the existing manager. New manager is then destroyed.
⚠️
DontDestroyOnLoad restriction Do not place the MusicManager prefab as a child of another DontDestroyOnLoad object. Unity does not support nested DontDestroyOnLoad hierarchies.