Empty space at the top of a custom property drawer layout?

I’m talking about the empty space it leaves here above the “Text” label, which seems to be caused by the CustomPropertyDrawer for the localized text class:

Here I put a (absolute positioned) label right at the position passed to the CustomPropertyDrawer OnGUI method:

Is there a reason why the GUILayout methods skip a line?

Here we are 5 years later.

I was facing the same problem and here is a hacky, yet simple and effective way to fix this issue:

public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0; }

Add this override to the PropertyDrawer class and extra spaces will be gone (if you face any problems, do let me know)

Hi! Looks like the problem is not your label field, but the text input field after it. For some reason it is not drawing the full height of the space you have allocated for it. Not sure if it’s affecting this case but, you should not use EditorGUILayout inside of a PropertyDrawer. Just use the corresponding EditorGUI methods and manage the rectangles yourself. For example:

EditorGUI.BeginProperty(position, label, property);
Rect labelRect = position;
labelRect.height = EditorGUIUtility.singleLineHeight;
EditorGUI.PrefixLabel(labelRect, label);
position.y += labelRect.height + EditorGUIUtility.standardVerticalSpacing;
position.height -= EditorGUIUtility.standardVerticalSpacing + labelRect.height;
// do some text input control using position rect
EditorGUI.EndProperty();

That said, is there any reason you cannot use the built-in TextAreaAttribute for this case?