TylerTemp / SaintsField

A Unity Inspector extension tool focusing on script fields inspector enhancement
MIT License
148 stars 9 forks source link

[Milestone] IMGUI: Expandable should use object editor/custom editor instead of drawing each field #25

Closed TylerTemp closed 3 months ago

TylerTemp commented 3 months ago

After some digging, this seems impossible. For anyone who wants to try this feature, here are some problems I've encount which might help:

  1. CustomDrawer of PropertyAttribute, it can create and draw editor by:

    Object scriptableObject = property.objectReferenceValue;
    UnityEditor.Editor.CreateEditor(scriptableObject);
    editor.OnInspectorGUI();
  2. Doing this will trigger the layout system, which will close the current property drawer. This means in list this will be drawn under the list

  3. As most ScriptableObject uses CustomEditor rather than CustomPropertyDrawer, the propertyDrawer solution will have no point.

  4. This is possible for UnityEngine.Editor to solve for top level fields, but it will still not work for list/array because list element uses propertyDrawer not editor drawer.