public void ApplyChanges() { data.sfxVol = sfxSlider.value; data.musicVol = musicSlider.value; dm.saveData("soundData.txt", data.Serialize()); }
void Start() { data = new VolumeOptions(); dm = DataManager.Instance; string deserializedString; if (dm.loadData("soundData.txt", out deserializedString)) { data.Deserialize(deserializedString); musicVolume = data.musicVol; sfxVolume = data.sfxVol; } else { musicVolume = 70; sfxVolume = 75; } if (musicSlider) { musicSlider.value = musicVolume; sfxSlider.value = sfxVolume; AkSoundEngine.SetRTPCValue("music_volume", musicSlider.value); AkSoundEngine.SetRTPCValue("sfx_volume", sfxSlider.value); } else { AkSoundEngine.SetRTPCValue("music_volume", musicVolume); AkSoundEngine.SetRTPCValue("sfx_volume", sfxVolume); } /*musicSlider.value = musicVolume; * sfxSlider.value = sfxVolume;*/ data.sfxVol = sfxVolume; data.musicVol = musicVolume; dm.saveData("soundData.txt", data.Serialize()); }