diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index fc92235afb..6e7e36a102 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -20,12 +20,27 @@ public class GameController : MonoBehaviour if (instance == null) { instance = FindAnyObjectByType(); + if (instance == null) + { + var go = new GameObject("GameController"); + instance = go.AddComponent(); + DontDestroyOnLoad(go); + } } return instance; } } private void Awake() { + if(instance == null) + { + instance = this; + DontDestroyOnLoad(gameObject); + } + else if(instance != this) + { + Destroy(gameObject); + } } private void Start()