diff --git a/Editor.Extras/Drawers/CustomBuiltInDrawer.cs b/Editor.Extras/Drawers/CustomBuiltInDrawer.cs index cfc9bac3..9ec70a92 100644 --- a/Editor.Extras/Drawers/CustomBuiltInDrawer.cs +++ b/Editor.Extras/Drawers/CustomBuiltInDrawer.cs @@ -25,6 +25,8 @@ public override TriElement CreateElement(TriValue propertyValue, TriElem if (drawWithHandler) { + handler.SetPreferredLabel(property.DisplayName); + var visualElement = handler.CreatePropertyGUI(serializedProperty); if (visualElement != null && diff --git a/Unity.InternalAPIEditorBridge.012/ScriptAttributeUtilityProxy.cs b/Unity.InternalAPIEditorBridge.012/ScriptAttributeUtilityProxy.cs index 87605754..4c40621c 100644 --- a/Unity.InternalAPIEditorBridge.012/ScriptAttributeUtilityProxy.cs +++ b/Unity.InternalAPIEditorBridge.012/ScriptAttributeUtilityProxy.cs @@ -25,6 +25,16 @@ internal PropertyHandlerProxy(PropertyHandler handler) // ReSharper disable once InconsistentNaming public bool hasPropertyDrawer => _handler.hasPropertyDrawer; + public void SetPreferredLabel(string label) + { +#if UNITY_2022_2_OR_NEWER + if (_handler.propertyDrawer != null) + { + _handler.propertyDrawer.m_PreferredLabel = label; + } +#endif + } + public VisualElement CreatePropertyGUI(SerializedProperty property) { return _handler.propertyDrawer?.CreatePropertyGUI(property);