Exemple #1
0
 void Awake()
 {
     if (gameCont == null)
     {
         DontDestroyOnLoad(gameObject);
         gameCont = this;
     }
     else if (gameCont != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #2
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameCont>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find GameCont script");
        }
    }