void Start() { if (RespawnPoint.Value == null) { SetDefaultRespawnPoint(); } if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); gameObject.name = gameObject.name + " Instance"; SceneManager.sceneLoaded += OnLevelFinishedLoading; } else { Destroy(gameObject); //Destroy This GO since is already a Spawner in the scene } FindMainAnimal(); if (player == null) { Destroy(gameObject); //Destroy This GO since is already a Spawner in the scene } }
void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); gameObject.name = gameObject.name + " Instance"; } else { Destroy(gameObject); return; } SceneManager.sceneLoaded += OnLevelFinishedLoading; FindMainAnimal(); }