public void HandleVolumeChange() { float musicVolume = MathX.LinearToDecibels(musicSlider.value); float sfxVolume = MathX.LinearToDecibels(sfxSlider.value); mixer.SetFloat("musicVolume", musicVolume); mixer.SetFloat("sfxVolume", sfxVolume); PlayerPrefs.SetFloat("musicVolume", musicSlider.value); PlayerPrefs.SetFloat("sfxVolume", sfxSlider.value); }
private void Start() { mixer.SetFloat("masterVolume", MathX.LinearToDecibels(saveHelper.Settings.masterVolume)); mixer.SetFloat("musicVolume", MathX.LinearToDecibels(saveHelper.Settings.musicVolume)); mixer.SetFloat("sfxVolume", MathX.LinearToDecibels(saveHelper.Settings.sfxVolume)); }
private void OnSFXValueChanged(float value) { saveHelper.Settings.sfxVolume = value; mixer.SetFloat("sfxVolume", MathX.LinearToDecibels(value)); }
private void OnMasterValueChanged(float value) { saveHelper.Settings.masterVolume = value; mixer.SetFloat("masterVolume", MathX.LinearToDecibels(value)); }