Search Issue Tracker

Fixed

Votes

0

Found in [Package]

1.0.0-preview.9

Issue ID

1292209

Regression

No

[UI Toolkit] NullReferenceException thrown when element drag and drop from Hierarchy to Viewport in the UI Builder window

Package: UI Toolkit

-

When Element drag and drop from Hierarchy to Viewport in the UI Builder window then it causes the editor to throw NullReferenceException, 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. Hierarchy > Button > Drag and Drop to > Viewport

Actual Result:
NullReferenceException is thrown when Element(Button) drag and drop to Viewport from Hierarchy

Expected Result:
The element should be drag and drop gracefully and create duplicate of existed element

Note:
UI Toolkit package introduced in the Unity 2020.1.0b12
UI toolkit is core package onwards 2021.1.0a5

Reproducible in:
2021.1.0a5, 2020.2.0b11, 2020.1.12f1, 2020.1.0b12with package version 1.0.0-preview.9, 1.0.0-preview.1, 0.11.2-preview

Environment:
Occurring on Windows 10 & macOS 10.15.

Stack trace:
NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.BuilderHierarchyDragger.PerformAction (UnityEngine.UIElements.VisualElement destination, Unity.UI.Builder.BuilderDragger+DestinationPane pane, System.Int32 index) (at <b6a7b7d551684226bf5fd4838e9d1c24>:0)
Unity.UI.Builder.BuilderDragger.OnMouseUp (UnityEngine.UIElements.MouseUpEvent 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.MouseCaptureDispatchingStrategy.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.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.