MOST Audio Manager

A persistent audio settings controller that maps 0–1 sliders and mute toggles to a Unity AudioMixer via exposed parameter names, with JSON save/load.

You can use Universal Game Manager to automatically set/control the audio manager

  • Safe-by-default: If no Mixer or parameter name is set, Apply() is a no‑op (no errors).

  • Four Ready-To-Go logical channels: Master, Music, SFX, UI.

  • Persistence: Optional auto‑load on Play; auto‑save on change and/or on inspector edits.

  • Mixer routing hints: Optional AudioMixerGroup references for Master/Music/SFX/UI to route AudioSource.outputAudioMixerGroup in your playback code.


Quick Start

  1. Create an Audio Mixer ProjectCreate → Audio Mixer and one or more child groups (Master/Music/SFX/UI) as you prefer.

  2. Expose the group Volume parameters:

    • In the Mixer window, right‑click a group’s Volume → Expose.

    • In the Exposed Parameters list, give each a clear name (e.g., MasterVolume, MusicVolume, SFXVolume, UIVolume).

  3. Create the asset: ProjectCreateMOSTAudio Manager → name it M_AudioManager.

  4. In the asset inspector:

    • Assign Mixer to your Audio Mixer.

    • (Optional) Assign MasterGroup / MusicGroup / SFXGroup / UIGroup.

    • Ensure the Exposed Parameter Names match your Mixer’s names.

  5. Call once on boot (e.g., from a bootstrap component): audioManager.ApplyAll(); (or rely on auto‑load).

  6. Bind UI to SetVolume(channel, value) and SetEnabled(channel, on). Leave ranges at [0..1].


Persistence Settings

autoLoadOnEnable: On Play, load from file if present, else keep inspector defaults and save.

autoSaveOnChange: Save after any SetVolume / SetEnabled (Toggle) / Apply

autoSaveInEditor: Mirror AudioManager inspector edits in Edit Mode (apply + save). (All audio controls will be visible on enable).

databaseKey: By default, "audio_state.json"... refers to the file name under Application.persistentDataPath.


API












Bind to UI

Last updated