Search Issue Tracker

Fixed in 1.0.0-preview.10

Votes

0

Found in [Package]

2021.1.0a5

2021.1.0a6

Issue ID

1292215

Regression

No

[UI Toolkit] NullReferenceException thrown when Undo operation is performed with Image Background in the Inspector

Package: UI Builder

-

When undo operation is performed with Background Image under Inspector tab in the UI Builder Window then it causes the editor to throw NullReferenceException continuously, Refer to the attached video.

Steps to repro:
1. Create a new project
2. Window > UI Toolkit > UI Builder
3. Library > Button > right-click > Add
4. Inspector > Background > Add Texture
5. Switch between Sprite and Texture from the dropdown
6. Repeat step 4
7. Edit > Undo Change UI Style Value (Ctrl+Z)

Actual Result:
NullReferenceException is thrown when undo operation is performed with Background Image under Inspector tab

Expected Result:
Undo operation is performed gracefully

Note:
1. Texture and Sprite options dropdown introduced in 2021.1.0a5
2. UI toolkit is core package onwards 2021.1.0a5

Reproducible in:
2021.1.0a6, 2021.1.0a5

Environment:
Occurring on Windows 10 & macOS 10.15.

Stack trace:
NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.BuilderInspectorStyleFields.RefreshStyleField (System.String styleName, UnityEngine.UIElements.VisualElement fieldElement) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspectorLocalStyles.Refresh () (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspector.RefreshUI () (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspector.RefreshAfterFirstInit (UnityEngine.UIElements.GeometryChangedEvent evt) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.DefaultDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIRLayoutUpdater.Update () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <f2a59ed0ea0d4e54baa7d077aaf5393a>:0)

NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.BuilderInspectorStyleFields.RefreshStyleField (System.String styleName, UnityEngine.UIElements.VisualElement fieldElement) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspectorLocalStyles.Refresh () (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspector.RefreshUI () (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderInspector.StylingChanged (System.Collections.Generic.List`1[T] styles, Unity.UI.Builder.BuilderStylingChangeType changeType) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderSelection.NotifyOfStylingChangePostStylingUpdate () (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderSelection.AfterPanelUpdaterChange (UnityEngine.UIElements.GeometryChangedEvent evt) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.DefaultDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <ea9e8ac7e3ff427f8b124b300d3b8a68>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <f2a59ed0ea0d4e54baa7d077aaf5393a>: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.