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
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)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Add comment