public MenuLabel(MenuPage page, string text, Vector2 dimensions) { Parent = page; (GameObject, Text, CanvasGroup) = PrefabMenuObjects.BuildDescText(Parent, text); GameObject.DestroyImmediate(GameObject.GetComponent <ContentSizeFitter>()); GameObject.DestroyImmediate(GameObject.GetComponent <AutoLocalizeTextUI>()); GameObject.DestroyImmediate(GameObject.GetComponent <FixVerticalAlign>()); Text.rectTransform.anchorMin = Text.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); Text.rectTransform.sizeDelta = dimensions; }
public MenuLabel(MenuPage page, string text, Style style = Style.Title) { Parent = page; switch (style) { default: case Style.Title: (GameObject, Text, CanvasGroup) = PrefabMenuObjects.BuildLabel(Parent, text); break; case Style.Body: (GameObject, Text, CanvasGroup) = PrefabMenuObjects.BuildDescText(Parent, text); break; } }