Menu music listens to volume slider now

This commit is contained in:
2025-06-24 13:31:52 -07:00
parent c13dd8439d
commit a5d37fdaf5
2 changed files with 2 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ public class MenuMusic : MonoBehaviour
Instance = this; Instance = this;
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneLoaded += OnSceneLoaded;
GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("musicVolume", 1f);
} }
else else
{ {

View File

@@ -54,6 +54,7 @@ public class SettingsMenu : MonoBehaviour
{ {
PlayerPrefs.SetFloat("musicVolume", value); PlayerPrefs.SetFloat("musicVolume", value);
PlayerPrefs.Save(); PlayerPrefs.Save();
MenuMusic.Instance.GetComponent<AudioSource>().volume = value;
}); });
sfxSlider.onValueChanged.AddListener(value => sfxSlider.onValueChanged.AddListener(value =>
{ {