Now UIToolkit support is opt-in

This commit is contained in:
VladV 2023-10-25 18:34:50 +04:00
parent cd828c6017
commit 6bbde41299
2 changed files with 13 additions and 8 deletions

View File

@ -25,15 +25,19 @@ namespace TriInspector.Drawers
if (drawWithHandler)
{
handler.SetPreferredLabel(property.DisplayName);
var visualElement = handler.CreatePropertyGUI(serializedProperty);
if (visualElement != null &&
TriEditorCore.UiElementsRoots.TryGetValue(property.PropertyTree, out var rootElement))
if (property.TryGetAttribute(out DrawWithUnityAttribute withUnityAttribute) &&
withUnityAttribute.WithUiToolkit)
{
return new TriUiToolkitPropertyElement(property, serializedProperty,
visualElement, rootElement);
handler.SetPreferredLabel(property.DisplayName);
var visualElement = handler.CreatePropertyGUI(serializedProperty);
if (visualElement != null &&
TriEditorCore.UiElementsRoots.TryGetValue(property.PropertyTree, out var rootElement))
{
return new TriUiToolkitPropertyElement(property, serializedProperty,
visualElement, rootElement);
}
}
return new TriBuiltInPropertyElement(property, serializedProperty, handler);

View File

@ -7,5 +7,6 @@ namespace TriInspector
[Conditional("UNITY_EDITOR")]
public class DrawWithUnityAttribute : Attribute
{
public bool WithUiToolkit { get; set; }
}
}