You started it, and kept no way to stop it.

The problem
Started, then out of reach.
void PlayMusic( string track ){ Sound.Play( track );} // level 2 startsPlayMusic( "music.level2" ); // both play now
Sound.Play starts it and hands you a handle. Throw the handle away and you can't stop just that sound.
The fix
Keep the handle.
The handle is your remote control for that one sound: stop it, fade it, change its volume.
Sound.Play()→SoundHandle→Stop()
The fix in code
Stop the old one first.
SoundHandle _music; void PlayMusic( string track ){ _music?.Stop( 0.25f ); _music = Sound.Play( track );}
Stop takes a fade time. Our desktop game swaps tracks exactly like this.
Also
Change it while it plays.
var h = Sound.Play( "coin", WorldPosition );if ( h is null ) return; h.Volume = 0.5f;h.Pitch = 1.5f;
Our parkour timer plays each tile a note higher by changing Pitch.
The rule
Might stop it later? Keep the handle.
- Start
- h = Sound.Play( ... )
- Stop
- h.Stop( fade )
- Adjust
- h.Volume, h.Pitch