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.
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
AudioMixerGroupreferences for Master/Music/SFX/UI to routeAudioSource.outputAudioMixerGroupin your playback code.
Quick Start
Create an Audio Mixer Project → Create → Audio Mixer and one or more child groups (Master/Music/SFX/UI) as you prefer.
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).
Create the asset: Project → Create → MOST → Audio Manager → name it
M_AudioManager.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.
Call once on boot (e.g., from a bootstrap component):
audioManager.ApplyAll();(or rely on auto‑load).Bind UI to
SetVolume(channel, value)andSetEnabled(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