public void DrawTextArea(SerializedProperty property, ResizableTextAreaAttribute attribute, GUIContent label = null) { if (property.propertyType == SerializedPropertyType.String) { DrawLabel(property, attribute, label); EditorGUI.BeginChangeCheck(); var textAreaValue = EditorGUILayout.TextArea(property.stringValue, GUILayout.MinHeight(Height(property))); if (EditorGUI.EndChangeCheck()) { property.stringValue = textAreaValue; } } else { EditorDrawUtility.DrawPropertyField(property); EditorDrawUtility.DrawHelpBox($"{typeof(ResizableTextAreaAttribute).Name} can only be used on string fields"); } }
public void DrawTextArea(Rect rect, SerializedProperty property, ResizableTextAreaAttribute attribute, GUIContent label = null) { if (property.propertyType == SerializedPropertyType.String) { DrawLabel(ref rect, property, attribute, label); EditorGUI.BeginChangeCheck(); var textAreaValue = EditorGUI.TextArea(new Rect(rect.x, rect.y + 18, rect.width, Height(property)), property.stringValue); if (EditorGUI.EndChangeCheck()) { property.stringValue = textAreaValue; } } else { EditorDrawUtility.DrawPropertyField(rect, property); rect.y += 18; rect.height -= 24; EditorDrawUtility.DrawHelpBox(rect, $"{typeof(ResizableTextAreaAttribute).Name} can only be used on string fields"); } }