I typed the following code expecting to see mute, solo and bypassEffects methods or properties, and I see…NONE of it from Intellisense. Where the heck is it hiding? How do you do that?
public AudioMixerGroup grp; // assign from Inspector
grp. // where are the mute / solo API?
You can either use mixer snapshots and transition to one of those snapshots, or you can expose any of the settings (like volume) for code, then use the exposed setting in your code (via AudioMixer.)
Snapshots are overkill. I only want to change the mute status of a couple Groups, nothing more. How do we expose the mute button for a Group and set it from code?
I don’t understand why this needs to be done. I have no idea why they didn’t just put the mute and solo switches into the normal API. It would be very useful.
Why is a snapshot overkill? You can transition to it with a duration of zero, effectively muting all your desired groups at once. Also, it is nicer to configure the snapshot from the editor than having to hardwire the muting into your code.
The mute button itself cannot be exposed to scripting, it seems. Instead, you just select any group, then in the inspector, right-click on the “Volume” label, and select “Expose ‘Volume …’ to script.” Then in your script, you can do this:
The muting would be far more useful for what I’m trying to do. Since I want to have a separately mutable music volume, SFX volume and ambient volume, that means I’d need to create 2x2x2 = 8 snapshots to get all the mute combinations? Ludicrous.
Snapshots are great for some things, but the mute control should still be exposed automatically from code. No solution to this?
I don’t necessarily want to set the volume…just mute it. I don’t want to lose the volume level previously set.
I’ve come to the same conclusion.
I’m looking into the mixer for a procedural project (using Master Audio) and while the manual looks great you can’t seem to access anything low level.
How you you control any of the mixer FX from code, for example?
No. Granted, the snapshots are mixer-wide, but you can always create sub-mixers. In your case, you could create separate mixers for music, sfx, and ambient, all of which only have the default “Master” group. Then, you can route those mixers into your main mixer. For the three mixers, you can set up snapshots to mute them separately.
I agree. I don’t think it is possible right now, though.
I see. It wasn’t clear to me you wanted to “keep” the previous volume.
Umm… Even exposing the volume parameter isnt working for me. I get an error CS1061 saying
Type ‘UnityEngine.Audii.AudioMixerGroup’ doe not contain a definition for ‘SetFloat’ and no extention method ‘SetFloat’ of typr ‘UnityEngine.Audio.AudioMixerGroup’ could be found. Are you missing an assembly reference?
Sorry for the noob question
Bumping this.
Has there been any update concerning the exposure of Solo, Mute and Bypass modes?
I find myself having the same need as jerotas here with music and sfx, I have combinations of volumes management AND options to entirely mute content. It seemed more intuitive to work with these functions than fiddle with a maze of mixers.
Nevertheless, using an array of sub-mixers does work, notably by creating snapshots for MSB options, but it is over-engineered and not edit-friendly: I didn’t find a way to copy portions of the Groups hierarchy of my main mixer into the new and separate sub-mixers. It’s absurd how much time I’m wasting recreating entire parts of the main Groups hierarchy. Right-clicking on any Group doesn’t reveal anything useful such as Copy/Paste options!
Finally, exposing certain variables could really be made much more accessible and obvious in the Inspector.
It’s sometimes increadibly frustrating to work with Unity when issues like this have been around for so long. Everything new and shiny gets mostly/half finished before the next big exciting thing comes along, and old core features such as this just get left to rot. This thread is nearly 5 years old and we still can’t unmute a mixer channel