public GUIElement(Selectable selectable, Text label) { if (selectable == null) { Debug.LogError("Rewired Control Mapper: Selectable is null!"); return; } this.selectable = selectable; this.gameObject = selectable.gameObject; this.rectTransform = gameObject.GetComponent <RectTransform>(); this.text = label; this.uiElementInfo = gameObject.GetComponent <UIElementInfo>(); children = new List <GUIElement>(); }
public GUIElement(GameObject gameObject) { if (gameObject == null) { Debug.LogError("Rewired Control Mapper: gameObject is null!"); return; } this.selectable = gameObject.GetComponent <Selectable>(); if (selectable == null) { Debug.LogError("Rewired Control Mapper: Selectable is null!"); return; } this.gameObject = gameObject; this.rectTransform = gameObject.GetComponent <RectTransform>(); text = UnityTools.GetComponentInSelfOrChildren <Text>(gameObject); this.uiElementInfo = gameObject.GetComponent <UIElementInfo>(); children = new List <GUIElement>(); }