Steps to reproduce:
- Create a 3D URP Project
- Navigate to Project Settings > UI Toolkit and enable "Enable in-scene UI Authoring"
- In the Project Browser create 2 UI Toolkit > UI Documents
- Drag one into a Scene's Hierarchy and start editing it in Context by clicking the arrow button in the Hierarchy next to it
- In it's Hierarchy drag and drop the other UI Document and drill into it with the same arrow button
- When prompted to save select "Discard"
Actual results: On Discard the Console is flooded with errors and the in-Scene authoring view breaks:
- ArgumentException: Provided TemplateAsset is not part of the 'Parent' VisualTreeAsset. Parameter name: subDocumentPath
- NullReferenceException (repeating on repaint) via VisualElementSelectionRegistry.GetEditFlags
- NullReferenceException (repeating on pointer move) via PanelElement.LocalToPanelPosition
The stage falls back to the Main Stage in a half-torn-down state and the two NREs keep firing continuously. Returning to the Main Stage does not stop them; only a reload of the Editor will enable in-scene Authoring again
Expected results: Clicking Discard reverts the nested-instance addition cleanly and returns to the parent document (or Main Stage) with no exceptions and a working authoring view
Reproducible with versions: 6000.6.0b8, 6000.7.0a4
Can’t test with versions: 6000.0.81f1, 6000.3.22f1, 6000.5.8f1 (No in-Scene UI Authoring)
Tested on (OS): Windows 11