protected override void OnEnable() { base.OnEnable(); TextComponent = (QText)target; key = serializedObject.FindProperty("key"); }
public static QText AddComponent() { QText component = UtilityEditor.ExtensionComponentWhenCreate <QText>(typeof(QText).Name.ToString()); //设置默认值 SetDefaultValue(component); return(component); }
private static void SetDefaultValue(QText component) { if (component == null) { return; } component.font = DefaultFont; component.supportRichText = false; component.raycastTarget = false; component.alignment = TextAnchor.MiddleCenter; component.horizontalOverflow = HorizontalWrapMode.Overflow; component.color = Color.black; component.fontSize = 18; component.text = "QText"; }