Skip to content

Commit 05b0932

Browse files
committed
Fix UIToolkit drawer title
1 parent af37b2a commit 05b0932

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Editor.Extras/Drawers/CustomBuiltInDrawer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public override TriElement CreateElement(TriValue<object> propertyValue, TriElem
2525

2626
if (drawWithHandler)
2727
{
28+
handler.SetPreferredLabel(property.DisplayName);
29+
2830
var visualElement = handler.CreatePropertyGUI(serializedProperty);
2931

3032
if (visualElement != null &&

Unity.InternalAPIEditorBridge.012/ScriptAttributeUtilityProxy.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ internal PropertyHandlerProxy(PropertyHandler handler)
2525
// ReSharper disable once InconsistentNaming
2626
public bool hasPropertyDrawer => _handler.hasPropertyDrawer;
2727

28+
public void SetPreferredLabel(string label)
29+
{
30+
#if UNITY_2022_2_OR_NEWER
31+
if (_handler.propertyDrawer != null)
32+
{
33+
_handler.propertyDrawer.m_PreferredLabel = label;
34+
}
35+
#endif
36+
}
37+
2838
public VisualElement CreatePropertyGUI(SerializedProperty property)
2939
{
3040
return _handler.propertyDrawer?.CreatePropertyGUI(property);

0 commit comments

Comments
 (0)