From cd7195ffd19e1f0e5705a41ece307ec3034f93e3 Mon Sep 17 00:00:00 2001 From: Nicholas Novak <34256932+NickyBoy89@users.noreply.github.com> Date: Thu, 4 May 2023 22:16:43 -0700 Subject: [PATCH] fix: Delete old scene controllers when switching back to the main menu --- Assets/Scripts/SceneController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Scripts/SceneController.cs b/Assets/Scripts/SceneController.cs index 2a23368..7c9d8bf 100644 --- a/Assets/Scripts/SceneController.cs +++ b/Assets/Scripts/SceneController.cs @@ -16,6 +16,10 @@ public class SceneController : MonoBehaviour { Instance = this; } + else + { + Destroy(this); + } // Make this object stay around when switching scenes DontDestroyOnLoad(this.gameObject); SceneManager.sceneLoaded += OnSceneLoaded;