private void Awake() { if (instance == null) { instance = this; } else { // Only allow there to be one instance of SceneChanger at a time Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void Start() { // In Start because SceneChanger creates itself in its Awake sceneChanger = SceneChanger.Instance; }