Back to search
PatternGold tierAudio

Sound manager singleton for playing music and SFX with volume control

Updated 3mo ago
UE 5.0UE 5.1UE 5.2UE 5.3UE 5.4UE 5.5UE 5.6UE 5.7#sound#music#manager#volume#singleton

Reference

Pattern: Put in GameInstance for persistence. Variables MusicVolume(float)=1.0, SFXVolume(float)=1.0, CurrentMusic(AudioComponent). PlayMusic: IsValid(CurrentMusic) → Stop → SpawnSound2D(MusicAsset, MusicVolume) → store ref. PlaySFX: PlaySound2D(SFXAsset, SFXVolume). SetMusicVolume: SetVolumeMultiplier(CurrentMusic, NewVol). Save volumes to SaveGame.