Skip to content

#325 - Fixed a bug that expandable draws label twice. #338

Closed
njuwuyuxin wants to merge 1 commit into
dbrizov:masterfrom
njuwuyuxin:master
Closed

#325 - Fixed a bug that expandable draws label twice. #338
njuwuyuxin wants to merge 1 commit into
dbrizov:masterfrom
njuwuyuxin:master

Conversation

@njuwuyuxin
Copy link
Copy Markdown
Contributor

It may cause display error in Scriptable Wizard.

In ExpandablePropertyDrawer.cs:

  • When drawing expandable property, it calls EditorGUI.Foldout(). It may draw property label once.
  • After that , it calls EditorGUI.PropertyField() with label override. It may draw property label twice.

This problem was not discovered in inspector for the label totally overlaped when drawing twice.
But in Scriptable Wizard, the second label can't overlap on the first label (Maybe for the indent reason)

image

image

@njuwuyuxin
Copy link
Copy Markdown
Contributor Author

This issue has the same problem and may be fixed, too.
#306 - Expandable Attribute label is broken in custom editor window

@rhys-vdw
Copy link
Copy Markdown
Contributor

Looking forward to seeing this one merged!

@chuwilliamson
Copy link
Copy Markdown

nice good job

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Unity Editor drawing issue in ExpandablePropertyDrawer where an expandable ScriptableObject reference can render its label twice (notably visible in ScriptableWizard UI).

Changes:

  • Updates the ScriptableObject reference field drawing call to avoid passing a label explicitly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

};

EditorGUI.PropertyField(propertyRect, property, label, false);
EditorGUI.PropertyField(propertyRect, property, false);
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EditorGUI.PropertyField(propertyRect, property, false) still draws a label (it treats the label as null and falls back to property.displayName), so the foldout label and the object field label can still be rendered twice. To truly suppress the second label, pass an explicit empty label (e.g., GUIContent.none) and let the foldout handle the label area.

Copilot uses AI. Check for mistakes.
@dbrizov
Copy link
Copy Markdown
Owner

dbrizov commented Apr 9, 2026

Merge branch 'njuwuyuxin-master' into 'v2' - b101d86

I modified it further. Your fix still draws 2 labels, they are just right obove each other. The proper fix is to skip the second label entirely, and let the foldout draw it - 0b3132e

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants