Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
     player = FindObjectOfType <PlayerLevelChange>();
     //player.playerChangeLevelEvent.AddListener(SetCollisionLayer);
 }
Ejemplo n.º 2
0
    [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;
    }