private static MenuOption CreateMenuOption(string optionText, System.Action <TitleScreen> _action) { GameObject gameObject = new GameObject(optionText); RectTransform _rectTransform = gameObject.AddComponent <RectTransform>(); _rectTransform.parent = TitleMenu; _rectTransform.anchoredPosition = Vector2.zero; CanvasRenderer canvasRenderer = gameObject.AddComponent <CanvasRenderer>(); Text _text = gameObject.AddComponent <Text>(); _text.alignment = TextAnchor.MiddleCenter; _text.color = new Color32(184, 192, 195, 153); _text.font = FontData.defaultFontData.font; _text.fontSize = 34; _text.horizontalOverflow = HorizontalWrapMode.Overflow; _text.resizeTextMinSize = 3; _text.text = optionText; _text.verticalOverflow = VerticalWrapMode.Overflow; Button _button = gameObject.AddComponent <Button>(); _button.onClick.AddListener(() => _action(Title)); _button.transition = Selectable.Transition.None; EventTrigger _eventTrigger = gameObject.AddComponent <EventTrigger>(); Outline outline = gameObject.AddComponent <Outline>(); string _uiRef = GetUIRefName(optionText); if (!UITextDict.ContainsKey(_uiRef)) { UITextDict.Add(_uiRef, optionText); } TextManager.AddUIRef(_uiRef, _text); return(new MenuOption { action = _action, uiRef = _uiRef, rectTransform = _rectTransform, text = _text, button = _button, eventTrigger = _eventTrigger }); }