the symptom, in your words

"s&box has no project-authorable mixer bus system"

✓ verified on 26.07.22
lane Audioposted

▸ 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:

  • .mixer is absent from asset_types, so the editor cannot create one.
  • The Mixer constructor is assembly-internal, so game code cannot new one.
  • Mixer.FindMixerByName returns 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:

  1. Keep a gain value per category in game code, not as a mixer asset.
  2. Multiply the sound volume by that category gain when you play the sound.
  3. Route the sound through Sound.Play(string, Mixer) or set SoundHandle.TargetMixer to 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:

  1. Call Mixer.FindMixerByName(name) for the category bus you want.
  2. If it returns a Mixer, route through it.
  3. 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.

Verified on engine 26.07.22: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Published.

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord