public void Start() { menu = GameObject.FindGameObjectWithTag(TagList.menuUI); // create a menu if there isn't one already if (menu == null) { menu = Instantiate(menuPrefab); } hoverCursor = menu.GetComponentInChildren <HoverCursor>(true); //TODO -- fix this, because right now Start is not guaranteed to execute after the menu prefab has instantiated its components. if (hoverCursor == null) { Debug.LogWarning("You must have a HoverCursor component"); } if (hoverCursor.cursorGraphic == null) { Debug.LogWarning("HoverCursor component does not have a cursorGraphic property"); } cursor = hoverCursor.cursorGraphic.transform.parent.gameObject; //TODO -- is there a shorter way to say this? cursorGraphic = hoverCursor.cursorGraphic.gameObject; menuCanvas = menu.GetComponentInChildren <Canvas>(true); if (menuCanvas == null) { throw new System.Exception("You must have a Canvas component"); } menuCanvasGroup = menu.GetComponentInChildren <CanvasGroup>(true); if (menuCanvasGroup == null) { throw new System.Exception("You must have a CanvasGroup component"); } menuTransform = menuCanvas.GetComponent <RectTransform>(); clientTagSetup = menu.GetComponent <ChildTextCreateOnCall>(); sessionAndBuildName = menu.GetComponent <MainUIReferences>().sessionAndBuildText; if (menuTransform == null) { throw new Exception("selection canvas must have a RectTransform component"); } if (rightHandedMenuAnchor == null) { throw new System.Exception("You must set a right-handed menu anchor"); } if (leftHandedMenuAnchor == null) { throw new System.Exception("You must set a left-handed menu anchor"); } menu.transform.SetParent(leftHandedMenuAnchor.transform); if (!sessionAndBuildName) { Debug.LogWarning("sessionAndBuildName was null. Proceeding anyways."); } menuExpandability = menuCanvas.GetComponent <ToggleExpandability>(); if (menuExpandability == null) { Debug.LogError("No ToggleExpandability component found", this); } cursorImage = menuCanvas.GetComponent <Image>(); if (cursorImage == null) { Debug.LogError("No Image component found on UI ", this); } DisplaySessionDetails(); }