diff options
Diffstat (limited to 'Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs')
-rw-r--r-- | Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs new file mode 100644 index 00000000..3850da2e --- /dev/null +++ b/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledTextDrawer.cs @@ -0,0 +1,45 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledText))]
+ public class StyledTextAttributeDrawer : PropertyDrawer
+ {
+ StyledText a;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledText)attribute;
+
+ GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
+ {
+ richText = true,
+ wordWrap = true
+ };
+
+ styleLabel.alignment = a.alignment;
+
+ GUILayout.Space(a.top);
+
+ if (a.disabled == true)
+ {
+ GUI.enabled = false;
+ }
+
+ GUILayout.Label(property.stringValue, styleLabel);
+
+ GUI.enabled = true;
+
+ GUILayout.Space(a.down);
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
+
|