Audio and music¶
Mixer¶
All sound goes through Audio/GameAudioMixer.mixer, with groups Master, Music, Weapon (weapons,
player projectiles, explosions), Enemy (enemies and their projectiles) and Effects (player, NPCs, doors,
chests, buttons, portal, UI). Each exposes a <Group>Volume parameter driven by the five sliders in the settings.
Every AudioSource needs a group
When you build a prefab with sound, set the AudioSource Output to the right GameAudioMixer group.
Otherwise the sound ignores the volume sliders.
Play sounds from code¶
AudioManager lives in CoreServices (one per scene):
using AiasTech.Audio;
// 3D sound routed to the mixer (AudioSource.PlayClipAtPoint ignores it)
AudioManager.PlayClipAt(clip, transform.position, AudioChannel.Effects);
AudioManager.Instance.PlayUISound(clickClip);
Set up music¶
Every track is a MusicTrack (clip + volume 0–1).
- Scene music: one
SceneMusiccomponent per scene.MainSceneplaysMusic_Explorationat 0.8; levels play it at 0.3. - Area music: a
MusicZonewith a triggerBoxColliderplays while the player is inside. - Ambush music: the
ambushMusicfield ofEnemyAmbushTrigger. With no clip, level music continues.
Temporary music (area, ambush) is stacked: on exit, the previous track resumes where it left off. Crossfades
keep running during pause. From code, use PlayMusic, PushMusicOverride and PopMusicOverride on
AudioManager.Instance.
Assign sounds¶
Most sounds are Inspector fields: EnemyEntity > Audio Settings; TurnWeaponProfile (AttackSound,
MissSound, ImpactSound); PlayerHealth and PlayerFootstepAudio; doors, buttons, pickups (PickUpSound),
the exit portal and ambushes. Included audio in Audio/ is CC0 or original; authors are in Audio/LICENSES.md.
Add a volume channel¶
- Create the mixer group and expose a
<Channel>Volumeparameter. - Add the value at the end of the
AudioChannelenum and map it inToSaveKey. - Create the key in
SaveSystemKeysand the field inProfileSaveModule. - Add the slider in
SettingsManagerand the group field inAudioManager.
Limits: no ducking, music queue, or music start/end events. For internals, see
Assets/DungeonCrawler/Scripts/Audio/ARCHITECTURE.md.