Steps to reproduce:
- Create and open a new project
- Open 'Edit -> Project Settings -> UI Toolkit'
- Enable 'in-scene UI Authoring'
- In Hierarchy, right-click -> UI Toolkit -> Standard Elements -> Visual Element
- Select the PanelRenderer GameObject
- Expand and select any one of the Object fields in the Inspector (don't open Object picker
- Collapse the Component
- Click on the hamburger menu icon and press 'Remove Component'
- Observe the Console and Hierarchy (Might need to be collapsed to see the effects)
Actual results: a 'MissingReferenceException: The object of type 'UnityEngine.UIElements.PanelRenderer' has been destroyed but you are still trying to access it.' is thrown and A detached reference to the UI hierarchy or its parts remains
Expected results: No error is thrown, Hierarchy renders as usual with no artifacts
Reproducible with versions: 6000.6.0a1, 6000.6.1f1, 6000.7.0a6
Can’t test with versions: 6000.0.83f1, 6000.3.24f1 (No Panel Renderer)
Tested on (OS): Windows 11 Pro (25H2)
Notes:
- The issue is quite inconsistent to reproduce, if this happens try Undoing and Redoing the Component removal
- Reloading the Hierarchy removes the artifacts until another reproduction
- When trying to expand the artifact another error is thrown: 'InvalidOperationException: HierarchyNode() not found'