Fix UIToolkit drawer title

This commit is contained in:
VladV 2023-10-15 12:56:15 +04:00
parent af37b2afa7
commit 05b0932901
2 changed files with 12 additions and 0 deletions

View File

@ -25,6 +25,8 @@ namespace TriInspector.Drawers
if (drawWithHandler)
{
handler.SetPreferredLabel(property.DisplayName);
var visualElement = handler.CreatePropertyGUI(serializedProperty);
if (visualElement != null &&

View File

@ -25,6 +25,16 @@ namespace TriInspectorUnityInternalBridge
// 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);