private void OnEnable() { foreach (var child in FindObjectsOfType <Transform>()) { if (child.name.Contains("Main_Canvas")) { MainCanvas = child.GetComponent <Canvas>().gameObject; OpenStartGameButton = MainCanvas.transform.GetChild(1).GetChild(0).GetComponent <Button>().gameObject; } if (child.name.Contains("Options_Canvas")) { OptionsCanvas = child.GetComponent <Canvas>().gameObject; BackButtonOptions = OptionsCanvas.GetComponentInChildren <Button>().gameObject; OptionsCanvas.SetActive(false); } if (child.name.Contains("Controls_Canvas")) { ControlsCanvas = child.GetComponent <Canvas>().gameObject; BackButtonControls = ControlsCanvas.GetComponentInChildren <Button>().gameObject; ControlsCanvas.SetActive(false); } if (child.name.Contains("Start_Game_Canvas")) { StartLocalGameCanvas = child.GetComponent <Canvas>().gameObject; StartGameButton = StartLocalGameCanvas.transform.GetChild(2).GetChild(3).GetComponent <Button>().gameObject; StartLocalGameCanvas.SetActive(false); } } }
public void Options() { SwitchCanvas(OptionsCanvas.GetComponent <Canvas>()); SetSelected(); }