private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        // Instantiate GameConfiguration
        m_gameConfiguration = Instantiate(m_gameConfigurationPrefab);
        DontDestroyOnLoad(m_gameConfiguration);

        // Instantiate player
        m_player = Instantiate(m_playerPrefab);
        DontDestroyOnLoad(m_player);
        m_player.GetComponent <PlayerRenderer>().Hide();

        // Assign player to game conf
        m_gameConfiguration.SetPlayer(m_player);

        m_spawnZoneConfiguration = Instantiate(m_spawnZoneConfigurationPrefab);
        DontDestroyOnLoad(m_spawnZoneConfiguration);

        SceneManager.LoadScene("MainMenu");
    }