#Custom propertyattribute help

1 messages · Page 1 of 1 (latest)

quick crow
#

Here's my drawer code:

{
    public override void OnGUI(Rect position)
    {
        FancyHeaderAttribute fancyHeaderAttribute = attribute as FancyHeaderAttribute;

        var style = new GUIStyle(EditorStyles.boldLabel);
        style.normal.textColor = fancyHeaderAttribute.color;

        EditorGUI.LabelField(position, fancyHeaderAttribute.text, style);
    }

    public override float GetHeight()
    {
        FancyHeaderAttribute fancyHeaderAttribute = attribute as FancyHeaderAttribute;

        var baseHeight = EditorGUIUtility.singleLineHeight * 2;

        if (fancyHeaderAttribute.underline) return baseHeight + 4;
        else                                return baseHeight;
    }
}```
#

When I have the height as a single line, the header shows up like this:

#

Makes sense

#

But when I have it as two lines, it shows up like this:

#

That doesn't make sense to me, why is it centered in the space?

#

I figured it would show up right below the COPD Lung field

#

And isn't this 3 lines? I'm just very confused by this, I don't understand why it shows up like this

#

For the record, what I want to end up with is the same behavior as a regular Header attribute, with a bold label that has one line of space above it