void Start() { Button btn = yourButton.GetComponent <Button>(); btn.onClick.AddListener(Clicked); rb = GameObject.Find("RobotGuessingManager").GetComponent <RobotGuesser>(); }
// Use this for initialization void Start() { gameController = GameObject.Find("GameManager").GetComponent <MainGameController>(); if (gameController.scene == Constants.ROBOT_GUESSING_SCENE) { guess = GameObject.Find("RobotGuessingManager").GetComponent <RobotGuesser>(); childbuilder = GameObject.Find("ExplainerSceneManager").GetComponent <ChildBuilder>(); guessedHouse = guess.finalHouse; builtHouse = childbuilder.explainerHouse; gameController.SendRobotUtterance("child-builder-compare-houses", false, -1, -1, -1); /*var cl = GameObject.Find("child_left"); * var rr = GameObject.Find("robot_right"); * * cl.gameObject.GetComponent<Text>().enabled = true; * rr.gameObject.GetComponent<Text>().enabled = true;*/ } else if (gameController.scene == Constants.CHILD_GUESSING_SCENE) { if (gameController.tutorial) { childTut = GameObject.Find("ChildGuessingManager").GetComponent <ChildGuesserTutorial>(); correct = childTut.chosenHouse; guessed = childTut.submittedHouse; } else { child = GameObject.Find("ChildGuessingManager").GetComponent <ChildGuesser>(); correct = child.chosenHouse; guessed = child.submittedHouse; } gameController.SendRobotUtterance("robot-builder-compare-houses", false, -1, -1, -1); /*var cr = GameObject.Find("child_right"); * var rl = GameObject.Find("robot_left"); * * cr.gameObject.GetComponent<Text>().enabled = true; * rl.gameObject.GetComponent<Text>().enabled = true;*/ } level = gameController.levelNumber; showOnScreen(); }