Skip to content

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 SceneMusic component per scene. MainScene plays Music_Exploration at 0.8; levels play it at 0.3.
  • Area music: a MusicZone with a trigger BoxCollider plays while the player is inside.
  • Ambush music: the ambushMusic field of EnemyAmbushTrigger. 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

  1. Create the mixer group and expose a <Channel>Volume parameter.
  2. Add the value at the end of the AudioChannel enum and map it in ToSaveKey.
  3. Create the key in SaveSystemKeys and the field in ProfileSaveModule.
  4. Add the slider in SettingsManager and the group field in AudioManager.

Limits: no ducking, music queue, or music start/end events. For internals, see Assets/DungeonCrawler/Scripts/Audio/ARCHITECTURE.md.