-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When TriInspector is added to the Unity project, CustomPropertyDrawers won't work with UI Toolkit elements, but the UGUI system.
I suspect the behavior is similar to what is explained in this thread: https://discussions.unity.com/t/property-drawers/724398/95
Expected behavior
I'd like to be able to use public override VisualElement CreatePropertyGUI(SerializedProperty property) in my custom propertyDrawers that are not using any TriInspector functionality.
Code Sample
[CustomPropertyDrawer(typeof(WhateverPropertyAttribute))]
public class WhateverPropertyDrawer : PropertyDrawer {
public override VisualElement CreatePropertyGUI(SerializedProperty property) {
var container = new VisualElement();
container.style.flexDirection = FlexDirection.Row;
var propertyField = new PropertyField(property);
propertyField.Bind(property.serializedObject);
propertyField.style.flexGrow = 1;
container.Add(propertyField);
// Create buttons and add them to the container
Button button1 = new Button(() => Debug.Log("Button 1 pressed")) { text = "B1" };
Button button2 = new Button(() => Debug.Log("Button 2 pressed")) { text = "B2" };
Button button3 = new Button(() => Debug.Log("Button 3 pressed")) { text = "B3" };
container.Add(button1);
container.Add(button2);
container.Add(button3);
return container;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.PropertyField(position, property, label);
Debug.LogWarning("UI Toolkit not supported, falling back to IMGUI.");
}
}Screenshots
Desktop: Win 11
Unity version: Unity 6 LTS
Tri Inspector version: v1.14.1
Pectorelyjchun, Preliy, mnicolas94 and Volantk
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working