void Awake() { if (gv != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); gv = this; }
private void Start() { gv = FindObjectOfType <GameVolume>(); musicVolume = gv.MusicVolume; soundsVolume = gv.SFXVolume; if (value == "Music") { slider.value = musicVolume / 100f; } else { slider.value = soundsVolume / 100f; } AkSoundEngine.SetRTPCValue("music_option", musicVolume); AkSoundEngine.SetRTPCValue("sfx_option", soundsVolume); }