Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.




Found in [Package]


Issue ID




PropertyDrawer.CreatePropertyGUI will not get called when using a CustomPropertyDrawer with a generic struct

Package: UI Toolkit


How to reproduce:
1. Open the attached project
2. Open SampleScene
3. Select MyObject in the Scene Hierarchy
4. Observe MyComponent in the Inspector

Expected result: Two labels "Type A" and "Type B" are shown.
Actual result: "No GUI Implemented" and "Type B" is shown.

Reproducible with: 1.0.0-preview.3 - 1.0.0-preview.14 (2020.3.7f1, 2021.1.6f1), 2021.1.0a16
Could not test with: 2018.4.34f1, 2019.4.26f1 (UI Toolkit not supported)

  1. Resolution Note:

    UIToolkit property drawers are only supported when embedded inside a UIToolkit custom editor. This limitation will be addressed in a future release. From the time being, you can declare a custom UIToolkit editor that will look like the default inspector this way:

    public class MyComponentEditor : Editor
    public override VisualElement CreateInspectorGUI()
    var container = new VisualElement();

    // If you're running a recent version of the package, or 2021.2, you can use
    // InspectorElement.FillDefaultInspector(container, serializedObject, this);
    // otherwise, the code below basically does the same thing

    SerializedProperty property = serializedObject.GetIterator();
    if (property.NextVisible(true)) // Expand first child.
    var field = new PropertyField(property); = "PropertyField:" + property.propertyPath;

    if (property.propertyPath == "m_Script")
    if ((serializedObject.targetObject != null))

    while (property.NextVisible(false));

    return container;

Comments (1)

  1. KillHour

    Mar 16, 2022 03:32

    Hopefully this helps someone, but I was able to do this in a generic sense with the following:

    [CustomEditor(typeof(MonoBehaviour), true)]
    public class MonoBehaviourEditor : Editor
    public override VisualElement CreateInspectorGUI()
    var container = new VisualElement();
    InspectorElement.FillDefaultInspector(container, serializedObject, this);
    return container;

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.