diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index ac338b95..a244b34b 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -230,6 +230,7 @@ namespace RhythmHeavenMania public void Pause() { Conductor.instance.Pause(); + KillAllSounds(); } public void Stop(float beat) @@ -244,6 +245,8 @@ namespace RhythmHeavenMania { for (int i = 0; i < SoundObjects.Count; i++) Destroy(SoundObjects[i].gameObject); + + SoundObjects.Clear(); } #endregion diff --git a/Assets/Scripts/Util/Jukebox.cs b/Assets/Scripts/Util/Jukebox.cs index 953a44ce..3e6945a3 100644 --- a/Assets/Scripts/Util/Jukebox.cs +++ b/Assets/Scripts/Util/Jukebox.cs @@ -109,6 +109,10 @@ namespace RhythmHeavenMania.Util public static void KillLoop(AudioSource source, float fadeTime) { + // Safeguard against previously-destroyed sounds. + if (source == null) + return; + source.GetComponent().KillLoop(fadeTime); } }