void Awake() { if (gameCont == null) { DontDestroyOnLoad(gameObject); gameCont = this; } else if (gameCont != this) { Destroy(gameObject); } }
void Start() { GameObject gameControllerObject = GameObject.FindWithTag("GameController"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent <GameCont>(); } if (gameController == null) { Debug.Log("Cannot find GameCont script"); } }