void Awake() { progressBar = GameObject.FindGameObjectWithTag("ProgressBar").GetComponent <ProgressBarLogic>(); if (progressBar == null) { Debug.Log("Error: <ProgressBar> not found!"); } levelText = GameObject.FindGameObjectWithTag("LevelText").GetComponent <TextMeshProUGUI>(); if (levelText == null) { Debug.Log("Error: <LevelText> not found!"); } nextLevel = GameObject.Find("NextLevel"); if (nextLevel == null) { Debug.Log("Error: <NextLevel> not found!"); } previousLevel = GameObject.Find("PreviousLevel"); if (previousLevel == null) { Debug.Log("Error: <previousLevel> not found!"); } timerScript = GameObject.Find("Timer").GetComponent <TimerScript>(); if (timerScript == null) { Debug.Log("Error: <timerScript> not found!"); } eggCoinText = GameObject.Find("EggCoin").GetComponent <TextMeshProUGUI>(); if (eggCoinText == null) { Debug.Log("Error: <eggCoinText> not found!"); } upgradeButton = GameObject.Find("Upgrade"); if (upgradeButton == null) { Debug.Log("Error: <upgradeButton> not found!"); } chickenLogic = GameObject.FindWithTag("Player").GetComponent <ChickenLogic>(); if (chickenLogic == null) { Debug.Log("Error: <chickenLogic> not found!"); } pauseOverlay = GameObject.Find("PauseOverlay").GetComponent <SpriteRenderer>(); if (pauseOverlay == null) { Debug.Log("Error: <pauseOverlay> not found!"); } exitButton = GameObject.Find("ExitButton"); if (exitButton == null) { Debug.Log("Error: <exitButton> not found!"); } else { exitButton.SetActive(false); } chickAnimationScript = GameObject.Find("ChickAnimation").GetComponent <ChickAnimationScript>(); InitGame(); }
void Awake() { gameLogic = GameObject.FindGameObjectWithTag("GameLogic").GetComponent <GameLogic>(); if (gameLogic == null) { Debug.Log("Error: <GameLogic> not found!"); } progressBar = GameObject.FindGameObjectWithTag("ProgressBar").GetComponent <ProgressBarLogic>(); if (progressBar == null) { Debug.Log("Error: <progressBar> not found!"); } }