UI Builder exception when selecting controls - MissingMethodException

I keep running into a problem with the latest version of UI builder preview 12 -
Every time I use the UI builder to edit UXML documents, my console gets filled with the same error.
I am just using standard controls. The exception is a MissingMethodException that is thrown somewhere during the Unity.UI.Builder.BuilderAnchorer.SetStylesFromTargetStyles().

I am total unfamiliar with this class, so I have included the full stack trace below.
The exception is thrown even on a newly created UXML file, and with a blank scene loaded.
I am also having a problem where the UI builder inspector doesn’t draw (shows blank) which is probably a symptom of this same issue. Occasionally switching from the themes will update the inspector and it will start drawing, but it’s a total buggy mess, editing values in the inspector doesn’t get saved, nor does adding or reordering elements.

Unity Version: 2020.2.6f1
UI Toolkit: 1.0.0-preview.14
UI Builder 1.0.0-preview.12

Stack Trace
MissingMethodException: UnityEngine.UIElements.StyleLength UnityEngine.UIElements.ComputedStyle.get_width()

Unity.UI.Builder.BuilderAnchorer.SetStylesFromTargetStyles () (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.12/Editor/Builder/Manipulators/BuilderAnchorer.cs:54)

Unity.UI.Builder.BuilderTracker.Activate (UnityEngine.UIElements.VisualElement target) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.12/Editor/Builder/Manipulators/BuilderTracker.cs:51)

Unity.UI.Builder.BuilderManipulator.Activate (Unity.UI.Builder.BuilderPaneWindow paneWindow, Unity.UI.Builder.BuilderSelection selection, UnityEngine.UIElements.VisualTreeAsset visualTreeAsset, UnityEngine.UIElements.VisualElement target) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.12/Editor/Builder/Manipulators/BuilderManipulator.cs:40)

Unity.UI.Builder.BuilderViewport.SetInnerSelection (UnityEngine.UIElements.VisualElement selectedElement) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.12/Editor/Builder/Viewport/BuilderViewport.cs:489)

Unity.UI.Builder.BuilderViewport.OnPick (UnityEngine.UIElements.MouseDownEvent evt) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.12/Editor/Builder/Viewport/BuilderViewport.cs:353)

UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/EventCallback.cs:64)

UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/EventCallbackRegistry.cs:341)

UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/EventHandler.cs:147)

UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/IEventDispatchingStrategy.cs:147)

UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/MouseEventDispatchingStrategy.cs:35)

UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/MouseEventDispatchingStrategy.cs:26)

UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Events/MouseEventDispatchingStrategy.cs:19)

UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:377)

UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:340)

UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:302)

UnityEngine.UIElements.EventDispatcher.OpenGate () (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:266)

UnityEngine.UIElements.EventDispatcherGate.Dispose () (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:75)

UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:368)

UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/EventDispatcher.cs:218)

UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/Panel.cs:398)

UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/UIElementsUtility.cs:466)

UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/UIElementsUtility.cs:209)

UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/UIElementsUtility.cs:74)

UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.14/Core/UIElementsUtility.cs:28)

UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at :0)

It is worth noting that UI Builder 1.0.0-preview.11 does not throw an exception.

That seems to be the same issue as described here (more or less): When updateing to Unity 2020.2.3f1 UIToolkit throws compile errors

You could try to delete the UI Builder package and reimport it. That seems to fix the issue temporarily…

I haven’t looked too far into that problem, but from just a surface glance that looks like it unrelated to UI Builder which is where my problem appears. Perhaps I’m wrong, but I’m not certain they are related problems.

Same issue here

The error does look similar to the thread mentioned above (MissingMethodException). The issue tracker for this bug gives a workaround in the description:
Rolling back UI Builder to 1.0.0-preview.11 and then back to 1.0.0-preview.12 fixes the issue

1 Like

This work around is not a permanent fix for me. The problem still crops up. I’m just going to use preview 11 until it is fixed

Yup, using Preview 11 is much more stable for me as well in Unity 2020.2.4f1, I’ll be sticking to this package version for a little while too!

Hello! A new version of the UI Builder is out and should fix these issues reported here.

1 Like