// Use this for initialization void Start() { //Sets up the buttons Button[] buttons = this.GetComponentsInChildren <Button> (); foreach (Button but in buttons) { string name = but.gameObject.name; switch (name) { case "Login": loginButton = but; break; default: break; } } InputField[] fields = this.GetComponentsInChildren <InputField> (); foreach (InputField field in fields) { string name = field.gameObject.name; switch (name) { case "Username": username = field; break; case "Password": password = field; break; default: break; } } Text[] texts = this.GetComponentsInChildren <Text> (); foreach (Text text in texts) { string name = text.gameObject.name; switch (name) { case "Error": error = text; break; default: break; } } lumberUI = this.GetComponentInParent <LumberUI> (); lumberjackSelector = this.GetComponentInParent <LumberUI> ().lumberjackSelector.GetComponent <Selector>(); }
// Use this for initialization void Start () { //Sets up the buttons Button[] buttons = this.GetComponentsInChildren<Button> (); foreach (Button but in buttons) { string name = but.gameObject.name; switch (name) { case "AxePowerButton": axePowerButton = but; axePowerCostText = but.gameObject.GetComponentInChildren<Text> (); break; case "AxeSpeedButton": axeSpeedButton = but; axeSpeedCostText = but.gameObject.GetComponentInChildren<Text> (); break; case "BootsButton": bootsButton = but; bootsCostText = but.gameObject.GetComponentInChildren<Text> (); break; case "BackpackButton": backpackButton = but; backpackCostText = but.gameObject.GetComponentInChildren<Text> (); break; case "LumberMillButton": lumberMillButton = but; lumberMillCostText = but.gameObject.GetComponentInChildren<Text> (); break; case "LogoutButton": logoutButton = but; break; default: break; } } Text[] texts = this.GetComponentsInChildren<Text> (); foreach (Text text in texts) { string name = text.gameObject.name; switch (name) { case "Money": moneyText = text; break; case "AxePowerLv": axePowerText = text; break; case "AxeSpeedLv": axeSpeedText = text; break; case "BootsLv": bootsText = text; break; case "BackpackLv": backpackText = text; break; case "BackpackLoad": backpackLoadText = text; break; case "LeaderBoard": leaderboardText = text; break; case "LeaderBoardLumber": leaderboardLumberText = text; break; default: break; } } leaderboardText.text = ""; leaderboardLumberText.text = ""; lumberUI = this.GetComponentInParent<LumberUI> (); lumberjackSelector = this.GetComponentInParent<LumberUI> ().lumberjackSelector.GetComponent<Selector>(); }
// Use this for initialization void Start () { //Sets up the buttons Button[] buttons = this.GetComponentsInChildren<Button> (); foreach (Button but in buttons) { string name = but.gameObject.name; switch (name) { case "CreateButton": createButton = but; break; case "CancelButton": cancelButton = but; break; default: break; } } InputField[] fields = this.GetComponentsInChildren<InputField> (); foreach (InputField field in fields) { string name = field.gameObject.name; switch (name) { case "Username": username = field; break; case "Password": password = field; break; case "PasswordRepeat": passwordRepeat = field; break; default: break; } } Text[] texts = this.GetComponentsInChildren<Text> (); foreach (Text text in texts) { string name = text.gameObject.name; switch (name) { case "Error": error = text; break; default: break; } } lumberUI = this.GetComponentInParent<LumberUI> (); lumberjackSelector = this.GetComponentInParent<LumberUI> ().lumberjackSelector.GetComponent<Selector>(); }
// Use this for initialization void Start() { //Sets up the buttons Button[] buttons = this.GetComponentsInChildren <Button> (); foreach (Button but in buttons) { string name = but.gameObject.name; switch (name) { case "AxePowerButton": axePowerButton = but; axePowerCostText = but.gameObject.GetComponentInChildren <Text> (); break; case "AxeSpeedButton": axeSpeedButton = but; axeSpeedCostText = but.gameObject.GetComponentInChildren <Text> (); break; case "BootsButton": bootsButton = but; bootsCostText = but.gameObject.GetComponentInChildren <Text> (); break; case "BackpackButton": backpackButton = but; backpackCostText = but.gameObject.GetComponentInChildren <Text> (); break; case "LumberMillButton": lumberMillButton = but; lumberMillCostText = but.gameObject.GetComponentInChildren <Text> (); break; case "LogoutButton": logoutButton = but; break; default: break; } } Text[] texts = this.GetComponentsInChildren <Text> (); foreach (Text text in texts) { string name = text.gameObject.name; switch (name) { case "Money": moneyText = text; break; case "AxePowerLv": axePowerText = text; break; case "AxeSpeedLv": axeSpeedText = text; break; case "BootsLv": bootsText = text; break; case "BackpackLv": backpackText = text; break; case "BackpackLoad": backpackLoadText = text; break; case "LeaderBoard": leaderboardText = text; break; case "LeaderBoardLumber": leaderboardLumberText = text; break; default: break; } } leaderboardText.text = ""; leaderboardLumberText.text = ""; lumberUI = this.GetComponentInParent <LumberUI> (); lumberjackSelector = this.GetComponentInParent <LumberUI> ().lumberjackSelector.GetComponent <Selector>(); }