Example #1
0
        public float GetElementHeight(MightySerializedField serializedField, int index, BasePropertyDrawerAttribute baseAttribute)
        {
            var element = serializedField.GetElement(index);

            return(element.propertyType != SerializedPropertyType.String
                ? MightyGUIUtilities.WARNING_HEIGHT
                : MightyGUIUtilities.TextHeight(element.stringValue, 3) + MightyGUIUtilities.FIELD_HEIGHT +
                   MightyGUIUtilities.FIELD_SPACING * 2);
        }
Example #2
0
        public void DrawTextArea(Rect position, SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.String)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{nameof(ResizableTextAreaAttribute)} can only be used on string fields");
                return;
            }

            DrawLabel(ref position, property, options, label);

            position.height      = MightyGUIUtilities.TextHeight(property.stringValue, 3);
            property.stringValue = EditorGUI.TextArea(position, property.stringValue);
        }
Example #3
0
        public void DrawTextArea(SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                DrawLabel(property, options, label);

                property.stringValue = EditorGUILayout.TextArea(property.stringValue,
                                                                GUILayout.Height(MightyGUIUtilities.TextHeight(property.stringValue, 3)));
            }
            else
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{nameof(ResizableTextAreaAttribute)} can only be used on string fields");
            }
        }