using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
public class ExampleClass : MonoBehaviour
{
public int Data;
}
[CustomEditor(typeof(ExampleClass))]
public class ww : Editor
{
public override VisualElement CreateInspectorGUI()
{
var root = new VisualElement();
var data = serializedObject.FindProperty("Data");
var UITKPropertyField = new PropertyField(data);
var IMGUIPropertyField = new IMGUIContainer(() => EditorGUILayout.PropertyField(data));
root.Add(UITKPropertyField);
root.Add(IMGUIPropertyField);
return root;
}
}
I encountered the same problem as the image I was decorating the InspectorGUI.
The PropertyField in the UI Toolkit is the same as the fields in other components, but does not match the other components created through IMGUI, such as EditorGUILayout.PropertyFeed.
What should I do in this case?