void _SetVolume(string key, float value) { if (AudioSettings.ContainsTypeKey(key)) { audioMixer.SetFloat(key, value); } }
void _LoadAudioSettings(AudioSettings audio) { foreach (string k in audio.Keys) { if (AudioSettings.ContainsTypeKey(k)) { float v; if (audio.TryGetValue(k, out v)) { _SetVolume(k, v); } else { Debug.LogError($"An error occurred while parsing '{k}' key of audio settings"); } } } Debug.Log(""); }