fix: Delete old scene controllers when switching back to the main menu
This commit is contained in:
parent
97419d36de
commit
cd7195ffd1
@ -16,6 +16,10 @@ public class SceneController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Destroy(this);
|
||||||
|
}
|
||||||
// Make this object stay around when switching scenes
|
// Make this object stay around when switching scenes
|
||||||
DontDestroyOnLoad(this.gameObject);
|
DontDestroyOnLoad(this.gameObject);
|
||||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||||
|
Loading…
Reference in New Issue
Block a user