diff --git a/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs b/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs index d32e1f2c..a7c2e3f1 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Sound/SoundManager.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.SceneManagement; namespace TON { @@ -22,6 +23,24 @@ namespace TON Destroy(gameObject); } } + + private void OnEnable() + { + // 씬 로드 이벤트에 리스너 등록 + SceneManager.sceneLoaded += OnSceneLoaded; + } + + private void OnDisable() + { + // 씬 로드 이벤트에서 리스너 제거 + SceneManager.sceneLoaded -= OnSceneLoaded; + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + // 씬이 바뀔 때마다 배경 음악 종료 + BgSoundPlay(null); + } public void SFXPlay(string sfxName, AudioClip clip) {