Skip to content

Add UI Toolkit support for SubclassSelector - #117

Merged
mackysoft merged 8 commits into
mainfrom
feature/ui-toolkit-subclass-selector
Oct 19, 2026
Merged

mackysoft merged 8 commits into
mainfrom
feature/ui-toolkit-subclass-selector

Conversation

@mackysoft

@mackysoft mackysoft commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add UI Toolkit Inspector support for [SubclassSelector] on Unity 2021.3 and later, preserving type selection, value restoration, context commands, Undo/Redo, Prefab editing, collections and existing subtype drawers.

Unity's native controls own alignment, indentation and spacing. Existing OnGUI subtype drawers use Unity's IMGUI property container; UI Toolkit-only drawers retain their bindings. Drawers implementing both APIs keep the existing OnGUI precedence.

Scope

  • Add per-property UI Toolkit views, native reference tracking and binding cleanup across type changes, collection changes and reattachment.
  • Share deferred type selection with IMGUI and record complete Undo snapshots for managed-reference changes.
  • Resolve inherited drawers and decorators through Unity's property handler. Preserve decorator/header/body order and Unity's exclusion of collection-field decorators from element rows.
  • Restore popup text after mixed types, preserve native disabled Foldout viewing, separate Foldout view changes from value edits, and match native Array/List selection policies at their patch-level boundaries.
  • Resolve Prefab binding style helpers from the native assembly used by each Editor version.
  • Keep EditMode fixtures under Assets/Tests, outside the distributed package, and a side-by-side comparison window, Scene and Prefab under Assets/Validation in the existing library project. Open Tools > SerializeReference Extensions > Validation > Open Comparison.
  • Run graphics-enabled CI on Unity 2021.3.45f2 and 6000.6.6f1 with an X11 window manager for native Editor window resizing and focus.

Native Unity behavior remains unchanged: Simple collection right-edge clipping, pre-2022.2 top-level collection decorations, 2021.3 disabled mouse-up rejection, and initial collection-binding value notifications observed in 6000.6.6f1 receive no independent compensation. Native rendering and tracking integration uses version-specific Unity internal APIs.

Verification

The required Verification check passed for head 6efe510 (CI run).

Editor Passed Failed Skipped
2021.3.45f2 198 0 0
6000.6.6f1 208 0 2

Targeted local EditMode checks cover the affected behavior:

Editor Operations checked
2021.3.45f2 Root/nested decorators, physical heading order, Array/List heading rendering without duplicates, collection edits/reordering, inherited field decorators and subtype OnGUI continuation/Undo. Final native decorator checks: 7/7 passed.
2022.3.62f3 The differing owned UI Toolkit decorator path: composite headings, decorated collection edits/reordering, inherited decorators and initially empty child groups. 4/4 passed.
6000.6.6f1 Native self/mutual-reference traversal, lazy collection expansion, nested UI Toolkit bindings and selector decorators. 12/12 passed.
  • Earlier scoped checks cover inherited drawers, mixed types, disabled Foldouts, nested value/view notifications, native Array/List selection/removal, Prefab Revert and continued editing.
  • The two generic value-type variance reproduction tests remain marked Explicit, as on main, for their recorded product defect. This change does not add or broaden any exclusion.
  • Native self-reference traversal was checked without library helpers; tests respect Unity's suppression of self re-entry. Product traversal behavior is unchanged.
  • Resize tests wait for the requested native window width and sample native/selector geometry at an actual Inspector paint. All indentation, input-column, width, margin, binding and editing assertions retain their tolerances; the arbitrary repeated-poll barrier was removed without increasing the deadline. Both affected tests passed locally on 2021.3 and Unity 6.
  • Two independent reviewers accepted the native decorator lookup, placement, lifetime and test corrections.
  • Existing scoped checks cover native menu targets, resize/focus stability, nested references, drawer bindings, mixed-object editing, Prefab operations and the comparison window. Earlier direct GUI checks remain valid within their recorded conditions; modifier-key multi-selection input remains unverified.

References

  • Manual comparison guide: Assets/Validation/SerializeReferenceExtensions/Guide.md.

Why
UI Toolkit Inspectors need the existing type selection, managed-reference commands and subtype drawers with Unity's own layout and binding behavior.

What Changed
Add per-property UI Toolkit views, native property rendering and version-specific reference tracking. Share deferred type selection with IMGUI, preserve complete Undo snapshots, and cover collection, drawer, context-menu and Prefab behavior in EditMode fixtures outside the package.

Impact
Keep Unity 2021.3 support and existing OnGUI drawer precedence. Layout follows each Editor's native controls, including Unity-side collection limitations.
Why
Manual validation needs native drawing and SubclassSelector in one visible comparison inside the library's existing Unity project.

What Changed
Add selectable IMGUI and UI Toolkit Inspectors, standard comparison copies, persistent Scene and Prefab data, multi-object targets and representative subtype drawers under Assets/Validation.

Impact
Keep the manual tools outside the distributed package and automated test assemblies. Inspect real Scene objects without rebuilding views on resize; retain native layout calculations.
Why
UI Toolkit rendering and managed-reference binding differ between the minimum supported Editor and the current Unity release.

What Changed
Run the existing graphics-enabled EditMode matrix on Unity 2021.3.45f2 and 6000.6.6f1.

Impact
Keep two CI versions while exercising the newer generic-support and UI Toolkit branches.
Why
The selector diverged from native PropertyField behavior when resolving
inherited managed-reference drawers, leaving mixed types, inspecting
disabled properties, publishing foldout changes and selecting list rows.

What Changed
Use Unity's property-context drawer resolution and restore mixed popup
text. Configure native foldout clicks and collection selection at Unity's
patch boundaries. Exclude nested foldout view changes from value
notifications and resolve binding style helpers across native assemblies.
Add scoped behavior tests against same-version native controls.

Impact
Preserves bool editing, Prefab styling and collection removal without
adding layout compensation. Targeted EditMode checks cover the affected
paths on 2021.3.45f2, 2022.3.62f3 and 6000.6.6f1. Native disabled-input
and initial-binding limitations remain unchanged.
Why
Unity 2021.3 does not render field decorators around custom UI Toolkit
drawers. View checks also assumed eagerly created children and treated a
collapsed body as the visible selector header.

What Changed
Render native handler decorators around legacy selectors, preserving their
collection-element exclusions and order. Keep decorators above the native
header, remove duplicate decorator discovery and prepare nested controls
through their actual Foldouts. Verify Array/List heading positions during
real IMGUI repaint and retain native layout comparison diagnostics.

Impact
Restores scalar and nested decorations without repeating collection
headings on rows or changing native layout calculations. Scoped checks
cover legacy IMGUI decorators and UI Toolkit decorator composition.
Why
Native NextVisible can suppress re-entry into a self reference, so a
maximum descendant depth does not guarantee six repeated property paths.

What Changed
Check bounded depth, distinct paths, visible direct children and parent
iterator preservation for self references. Keep exact finite-depth checks
for distinct mutually referencing objects and noncyclic branches.

Impact
Preserves the existing native traversal implementation and detects its
contract violations without forcing custom cycle expansion.
Why
Xvfb provides a display without managing EditorWindow resize or focus.
The CI logs contain repeated GTK geometry response delays; the minimum
Editor also terminated inside its native runtime before producing XML.

What Changed
Start Openbox in the test display session, require its native EWMH ready
signal and terminate it when the test command exits. Upload its log with
the existing artifacts and preserve the Editor exit status and licensing
cleanup.

Impact
Exercises the existing graphics-enabled matrix with managed windows.
No product layout correction, test exclusions or timeout increase is added.
Why
Repeated whole-Editor update polls can exhaust the existing deadline even
when the native layout is already settled on a slow graphical CI runner.
The former readiness check also accepted the previous window width.

What Changed
Require the requested root width, then capture native and selector geometry
at the Inspector's actual paint instead of counting identical polls.

Impact
Keep all indentation, input-column, margin, binding and edit assertions,
the existing deadline and product rendering unchanged.
@mackysoft
mackysoft merged commit f6528b3 into main Oct 19, 2026
4 checks passed
@mackysoft
mackysoft deleted the feature/ui-toolkit-subclass-selector branch October 19, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant