EditorGUILayout.PropertyField is not aligned with the default specification in IMGUIContainer.

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?

Hi,
Could you please file a bug report? Unity QA: Building quality with passion

OK!

1 Like

Any news about this? I have this same issue in 2022.3.20 and I don’t know if it has been fixed in a newer version. It’s not a functional blocker of course, but it’s very annoying