Diagram · Mixer groups beside the values of two snapshots
Diagram · Mixer groups beside the values of two snapshots View full-size figure

The symptom sits far from the cause

You move indoors and the ambience stays. It is tempting to dig through audio files or playback code, while the cause is usually a mixer snapshot that never changed. Creating a snapshot does not apply it. Something has to call the transition.

Tie snapshots to scene boundaries

Move the audio state with the scene. Our own record used a rule where ambience stops when moving indoors and waves get a dedicated channel through the harbour sections. The rule has to be written down or the next person repeats the mistake.

[SerializeField] AudioMixerSnapshot indoor;
[SerializeField] AudioMixerSnapshot outdoor;

void ApplyRoom(bool isIndoor)
{
    var target = isIndoor ? indoor : outdoor;
    target.TransitionTo(0.8f);   // zero here is heard as a cut
}

A zero second transition sounds like a glitch

Even with correct values, an instant change reads as an error rather than a scene change. Give it a short ramp. Too long and the room falls quiet seconds after the door closes, which feels unresponsive.

Parameters have to be exposed to be scriptable

A mixer parameter is unreachable from code until you expose it. Expose it first if you intend to drive volume from a script.

mixer.SetFloat("MusicVolume", Mathf.Log10(value) * 20f); // the exposed parameter name

Expected result and next step

When opening and closing a door changes the sound without drawing attention, this item is done. A manifest is next: a table of which scene uses which track tells you immediately what a track swap affects.

Verification scope

Official documentation review

Verified

Reviewed the article's code and procedure against official Unity documentation and marked it ready for publication. This is not a claim of an independent Unity project or device reproduction; version- or device-specific reports will be checked in that environment as follow-up.

Official documentation checkedAudio Mixer ↗