I use GUILayout.Space(px) to add space after some property. Property is drawn using PropertyDrawer via PropertyAttribute.

Inspector Window

You can see that Min Max Prop displays properly inside targetObject(AudioPlayer) but if it's in nested object like Engine, Engine Multi, Filed it adds space to the targetObject not the nested object itself.

  • \$\begingroup\$ sharing the code might help us get on the right track and fix the problem. \$\endgroup\$
    – Uri Popov
    Oct 30, 2017 at 9:37
  • \$\begingroup\$ @UriPopov can't do that right now. pastebin.com/KkUPyYu6 - the same principle to how that is done. HideInDerivedAttribute simply empty class that inherits PropertyAttribute. The problem is not in my code but in Unity API. It should target nested object, instead, it targets object at the top of the hierarchy. I'm looking for some workaround. If I get home, maybe I will be able to post related code. \$\endgroup\$ Oct 30, 2017 at 10:45

1 Answer 1


It is possible in nested objects by adding height to overridden GetPropertyHeight() of PropertyDrawer.


namespace Kimo.Assistance.UTILITY
    public class MultiSupportPropertyAttributeDrawer : PropertyDrawer
        private MultiSupportPropertyAttribute _attribute;

        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
            if (this._attribute == null)
                this._attribute = this.attribute as MultiSupportPropertyAttribute;

            return base.GetPropertyHeight(property, label) + this._attribute.GetPropertyExtensionHeight();

        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
            //foreach (var attribute in fieldInfo.GetCustomAttributes(false))
            //  (attribute as MultiSupportPropertyAttribute).DrawInInspector(position, property, label);

            this._attribute.BeginDrawInInspector(position, property, label);
            this._attribute.DrawInInspector(position, property, label);
            this._attribute.EndDrawInInspector(position, property, label);

GetPropertyExtensionHeight() - is my method that needs to be overridden. It just adds some space instead of giving a full new space size.

Usage example

public override float GetPropertyExtensionHeight()
    if (this._compactFormat)
        return InspectorUtility.DEFAULT_FIELD_HEIGHT;
    return 0;

Works like a charm:

Working example


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .