"s&box has no project-authorable mixer bus system"
▸ SYMPTOM
You want per-category audio routing, so you look for a .mixer asset to author buses like Music, SFX, and UI. There is no such asset type to create.
You try to construct a Mixer from game code and the constructor is not accessible. You call Mixer.FindMixerByName with your own bus name and it returns null. Verified on engine 26.07.22.
▸ CAUSE
Engine 26.07.22 has no project-authorable mixer bus system. There is no .mixer resource type at all. Three checks confirm this:
.mixeris absent fromasset_types, so the editor cannot create one.- The
Mixerconstructor is assembly-internal, so game code cannotnewone. Mixer.FindMixerByNamereturns null for any name other than the shipped defaults.
Only three mixers exist: Master, Default, and Voice.
▸ FIX
Do category volume and routing in code, applied as per-category gain at play time:
- Keep a gain value per category in game code, not as a mixer asset.
- Multiply the sound volume by that category gain when you play the sound.
- Route the sound through
Sound.Play(string, Mixer)or setSoundHandle.TargetMixerto one of the three shipped mixers.
To future-proof the code, call Mixer.FindMixerByName first and fall back to code-side gain only when it returns null:
- Call
Mixer.FindMixerByName(name)for the category bus you want. - If it returns a
Mixer, route through it. - If it returns null, apply the code-side category gain instead.
▸ WHY IT WORKS
The real routing surface the engine gives game code is Sound.Play(string, Mixer) and SoundHandle.TargetMixer. Both take one of the three shipped mixers, so per-category gain has to live in code.
The FindMixerByName guard costs one lookup per play. If the engine ever ships project-level mixer authoring, the named bus resolves and the project picks up the authored routing with no code change.
- Published.