Search Issue Tracker

Fixed

Fixed in 6000.0.17f1, 7000.0.0a1

Votes

0

Found in

6000.0.13f1

7000.0.0a1

Issue ID

UUM-77085

Regression

Yes

UI Builders Elements in the Hierarchy or the Viewport break when switching Canvas Background modes with unsaved changes

--

-

*Steps to reproduce:*
# Create or open any Project with the UI Toolkit installed
# Create a "UI Document" Asset and open it
# Select the ".uxml" file in the Hierarchy
# In the UI Builders Inspector enable "Canvas Background"
# Add any Element in the Hiearchy and do not save the UI Document
# Switch the "Canvas Background" to "Image" or "Camera" and save the UI Document
# Try clicking on any of the Elements in the Viewport or the Hierarchy

*Actual results:*

UI Builder window becomes unusable, Elements cannot be manipulated in the Viewport or Hierarchy, UI Builder Windows has to be reopened

Error "NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.VisualTreeAsset.RemoveElementAndDependencies" is logged in Console every time Elements are clicked either in the Viewport or the Hierarchy

*Expected results:* No Errors are thrown

*Reproducible with versions:* 2023.3.0a6, 6000.0.13f1

*Not reproducible with versions:* 2021.3.40f1, 2022.3.40f1, 2023.3.0a5

*Tested on (OS):* macOS Sonoma, Windows 11

*Error message:*

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.VisualTreeAsset.RemoveElementAndDependencies (UnityEngine.UIElements.VisualElementAsset asset) (at <aff7113d094045d8bc63c60169e8e899>:0)
Unity.UI.Builder.BuilderAssetUtilities.RemoveElementFromSelectionInAsset (Unity.UI.Builder.BuilderDocument document, UnityEngine.UIElements.VisualElement ve) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.BuilderSelection.Select (Unity.UI.Builder.IBuilderSelectionNotifier source, UnityEngine.UIElements.VisualElement ve) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.BuilderViewport.OnPick (UnityEngine.UIElements.MouseDownEvent evt) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventCallbackRegistry+DynamicCallbackList.Invoke (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventDispatchUtilities.HandleEventAcrossPropagationPathWithCompatibilityEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.EventBase compatibilityEvt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.VisualElement target, System.Boolean isCapturingTarget) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCachedElementUnderPointerOrPanelRoot (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventDispatchUtilities.DispatchToCapturingElementOrElementUnderPointer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, System.Int32 pointerId, UnityEngine.Vector2 position) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.PointerEventBase`1[T].Dispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <aff7113d094045d8bc63c60169e8e899>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <98b89b20e7fa498f86e3aee402e1f36f>:0)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.