void Start() { player = GameObject.FindGameObjectWithTag("Player"); timeManager = GameObject.Find("TimeManager"); gameControllerObj = GameObject.Find("GameController"); if (player != null) { playerInfo = player.GetComponent <PlayerInformationScript>(); } else { Debug.LogError("PLAYER NOT FOUND"); } if (timeManager != null) { timeScript = timeManager.GetComponent <TimeCycleScript>(); } else { Debug.LogError("Cant find time"); } if (gameControllerObj != null) { gameController = gameControllerObj.GetComponent <GameControllerScript>(); } }
void Start() { if (Application.loadedLevelName == "HomeScene") { homeInstructPanel = GameObject.Find("Instruction_Panel"); playerObj = GameObject.FindGameObjectWithTag("Player"); timeManagerObj = GameObject.Find("TimeManager"); if (homeInstructPanel != null) { if (instructionPanelRead == false) { homeInstructPanel.SetActive(true); } else { homeInstructPanel.SetActive(false); } } else { Debug.LogError("Instruct panel not found"); } if (playerObj != null) { playerInfo = playerObj.GetComponent <PlayerInformationScript>(); playerName = playerInfo.playerName; playerScore = playerInfo.score; } else { Debug.LogError(playerObj.name + " not found!!"); } if (timeManagerObj != null) { timeScript = timeManagerObj.GetComponent <TimeCycleScript>(); } else { Debug.LogError(timeManagerObj.name + " not found!!"); } saveButton = GameObject.Find("SaveButton").GetComponent <Button>(); loadButton = GameObject.Find("LoadButton").GetComponent <Button>(); saveButton.onClick.AddListener(() => Save()); loadButton.onClick.AddListener(() => LoadInGame()); } }