protected virtual void SetGroupVolume(AudioMixerGroup group, float newValue) { var ID = GetGroupVolumeID(group); if (!group.audioMixer.SetFloat(ID, AudioUndumbifier.LinearToDB(newValue))) { throw new Exception("Couldn't set volume for Mixer Group " + group.name + " Make sure a volume parameter with the name " + ID + " Exists in your Audio Mixer"); } }
protected virtual float GetGroupVolume(AudioMixerGroup group) { float value; var ID = GetGroupVolumeID(group); if (!group.audioMixer.GetFloat(ID, out value)) { throw new Exception("Couldn't get volume for Mixer Group " + group.name + " Make sure a volume parameter with the name " + ID + " Exists in your Audio Mixer"); } return(AudioUndumbifier.DBToLinear(value)); }