Repository navigation
Add UI Toolkit support for SubclassSelector - #117
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
OnGUIsubtype drawers use Unity's IMGUI property container; UI Toolkit-only drawers retain their bindings. Drawers implementing both APIs keep the existingOnGUIprecedence.Scope
Assets/Tests, outside the distributed package, and a side-by-side comparison window, Scene and Prefab underAssets/Validationin the existing library project. OpenTools > SerializeReference Extensions > Validation > Open Comparison.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).Targeted local EditMode checks cover the affected behavior:
References
Assets/Validation/SerializeReferenceExtensions/Guide.md.