I have an AudioMixer setup with groups like this:
Everything in my game is configured to be under one of the 3 subgroups BGM/SFX/Ambience.
I have the parameters for the volume exposed:

And this is the logic I use to set the volume:
public static bool SetVolume01(this AudioMixer mixer, string name, float value)
{
if (value < 0.0001f)
{
value = -80f;
}
else
{
value = Mathf.Log10(Mathf.Clamp01(value)) * 20f;
}
return mixer.SetFloat(name, value);
}
Called like so:
public const string LABEL_AMBIENT = "AmbienceVolume";
private void _ambientVolumeWidget_Clicked(object sender, System.EventArgs e)
{
if (!_ambientVolumeWidget) return;
var audio = Services.Get<IAudioManager>();
if (audio != null)
{
audio.SetVolume(LABEL_AMBIENT, _ambientVolumeWidget.SelectedIndex / 10f);
}
PlayerPrefs.SetInt(PREF_AMBIENT, _ambientVolumeWidget.SelectedIndex);
}
Yes, I know it’s technically the type IAudioManager, that method just passes through to the audiomixer in question. Like so:
public bool SetVolume(string label, float value)
{
return _audioMixer.SetVolume01(label, value);
}
When I run this in editor all works just fine and I can mute any the 3 groups by setting the volume to 0.
But when I run this on Android device directly, it doesn’t work.
I’ve attached the debugger and stepped through the code. The logic gets called, the correct label is passed into the audiomixer and the correct db -80 when the volume is 0. No exceptions thrown, nothing. But it behaves like it’s at full volume.
Anyone have any ideas?
I’ve labeled as bug as I am left only thinking this is a Unity issue… unless I’m a complete dolt and missing something. Maybe the volume isn’t in db on Android???
