static GizmoHelper() { defaultLabelStyle = new EditorLabelStyle(EditorLabelStyle.Default) { fontSize = normalFontSize, textColor = defaultTextColor }; }
public static void Label(GUIContent content, EditorLabelStyle style) { #if UNITY_EDITOR var oldBg = GUI.backgroundColor; GUI.backgroundColor = style.backgroundColor; var labelStyle = style.GetGUIStyle(); GUILayout.Box(content, labelStyle); GUI.backgroundColor = oldBg; #endif }
public EditorLabelStyle(EditorLabelStyle src) { fontSize = src.fontSize; textColor = src.textColor; backgroundColor = src.backgroundColor; margin = new RectOffset(src.margin.left, src.margin.right, src.margin.top, src.margin.bottom); padding = new RectOffset(src.padding.left, src.padding.right, src.padding.top, src.padding.bottom); alignment = src.alignment; richText = src.richText; }
public static void Label(Vector3 position, string text, EditorLabelStyle style, LabelSize size = LabelSize.Normal) { #if UNITY_EDITOR if (string.IsNullOrEmpty(text)) { return; } var oldBgColor = GUI.backgroundColor; GUI.backgroundColor = style.backgroundColor; GUIStyle guiStyle = SetLabelSize(style.GetGUIStyle(), size); Handles.Label(position, text, guiStyle); GUI.backgroundColor = oldBgColor; #endif }
public static void Label(Vector3 position, string text, Color?bgColor = null, Color?textColor = null, LabelSize size = LabelSize.Normal) { #if UNITY_EDITOR var style = new EditorLabelStyle(defaultLabelStyle); if (bgColor.HasValue) { style.backgroundColor = bgColor.Value; } if (textColor.HasValue) { style.textColor = textColor.Value; } Label(position, text, style, size); #endif }
public static void Label(string text, EditorLabelStyle style) { Label(new GUIContent(text), style); }
public static void Label(Rect position, string text, EditorLabelStyle style) { Label(position, new GUIContent(text), style); }