private void Awake() { if (gameManagerControl == null) { gameManagerControl = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
void Awake() { // Force unity singleton pattern for gamemanager if (instance == null) { instance = this; } // If instance already exists and it's not equal to this, then destroy this (gameObject is this). Forces singleton pattern else if (instance != this) { Destroy(gameObject); } // Init the canvas controller CanvasControllerScript = FindObjectOfType <CanvasController>(); backgroundMusic = GetComponent <AudioSource>(); }
internal void IAm(GameManagerControl gameManagerControl) { theManager = gameManagerControl; }
void Start() { growingTimer = 0; transform.localScale = startingScale * Vector3.one; theManager = FindObjectOfType <GameManagerControl>(); }
public void SetGameManager(GameManagerControl tmp) { gmManager = tmp; }
// Use this for initialization void Start() { myGameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManagerControl>(); SetNewTarget(); }
// Use this for initialization public virtual void Start() { myGameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManagerControl>(); }