private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } player = FindObjectOfType <PlayerLevelChange>(); //player.playerChangeLevelEvent.AddListener(SetCollisionLayer); }
[SerializeField] List <PlayerSpawnPoint> spawnPoints = new List <PlayerSpawnPoint>(); //Contains all the spawn points in the current scene void Awake() { //========== Singleton design stuff ========== if (main == null) { DontDestroyOnLoad(gameObject); main = this; } else if (main != this) { Destroy(gameObject); } //========== Initialization ========== SceneManager.sceneLoaded += OnSceneLoaded; }