private void SetMixerGroupVolume(SavablePlayerPrefsValue <float> mixerGroup, float value, string mixerGroupName) { float bottomValueAccordingToScale = 0.0001f; Mathf.Clamp(value, bottomValueAccordingToScale, 1); value = Mathf.Log10(value) * normalizer; mixerGroup.Value = value; audioMixer.SetFloat(mixerGroupName, value); }
public void InitSettings() { SFXIsMuted = new SavablePlayerPrefsValue <bool>("SFXisMuted", false); MusicIsMuted = new SavablePlayerPrefsValue <bool>("MusicisMuted", false); masterVolume = new SavablePlayerPrefsValue <float>(MasterGroupVolumeName, 0f); sfxVolume = new SavablePlayerPrefsValue <float>(SFXGroupVolumeName, 0f); musicVolume = new SavablePlayerPrefsValue <float>(MusicGroupVolumeName, 0f); audioMixer.SetFloat(MasterGroupVolumeName, masterVolume.Value); audioMixer.SetFloat(MusicGroupVolumeName, (MusicIsMuted.Value ? minVolume : musicVolume.Value)); audioMixer.SetFloat(SFXGroupVolumeName, (SFXIsMuted.Value ? minVolume : sfxVolume.Value)); }
private void SetMixerGroupMuted(string mixerGroupName, bool isMuted, SavablePlayerPrefsValue <float> mixerGroup) { audioMixer.SetFloat(mixerGroupName, (isMuted ? minVolume : mixerGroup.Value)); }