Updated UI Toolkit from 6 to 12. Now i can’t interact with buttons. It’s work only on UI builder (Preview). I’m sure this is some small detail, but I cannot find a solution.
Hi. This is unusual. We’d love to have a copy of your project (simplified, if you want) to play around and find what’s wrong. Otherwise, I have a few questions that might help us discern the cause of your problem:
-
What version of Unity are you on?
-
Are you using the Input System package. If so, what Input option is selected in your Player Settings? (Other Settings > Configuration > Active Input Handling)
-
Do you have any non-UIToolkit UI in your scene? Canvas, StandaloneInputModule, EventSystem (UGUI)?
Thank you very much for the detailed answer. I found out what the mistake was.
-
My event system was broken.

Where can I read about how to set this up? Do I need to use one event system? Or is it different for each UI?
I have different controls and UI screens. I have active only one action map in one moment, other disable.

-
Elso my styles was broken. If i try used it, i have error. The solution is to re-create the styles.
Broken Styles
.main-menu-button {
-unity-font: url(‘/Assets/[2]Content/Fonts/StandartFormat/OpenSans-Regular.ttf’);
font-size: 30px;
background-color: rgba(0, 0, 0, 0);
color: rgb(255, 255, 255);
border-left-width: 0;
border-right-width: 0;
border-top-width: 0;
border-bottom-width: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
cursor: url(‘/Assets/[2]Content/UI/Cursor/cursor_Test_quest.psd’);
margin-left: 2px;
margin-right: 2px;
margin-top: 2px;
margin-bottom: 2px;
-unity-text-align: middle-center;
padding-left: 6px;
padding-right: 6px;
padding-top: 1px;
padding-bottom: 1px;
justify-content: flex-start;
-unity-background-scale-mode: stretch-to-fill;
flex-basis: auto;
flex-direction: column;
align-items: stretch;
position: relative;
height: 40px;
display: flex;
}
.main-menu-button:hover {
-unity-font: url(‘/Assets/[2]Content/Fonts/StandartFormat/OpenSans-Bold.ttf’);
font-size: 35px;
background-color: rgba(0, 0, 0, 0);
color: rgb(236, 195, 30);
border-left-width: 0;
border-right-width: 0;
border-top-width: 0;
border-bottom-width: 0;
border-top-left-radius: 0;
-unity-text-align: middle-center;
display: flex;
cursor: url(‘/Assets/[2]Content/Sprites/Cursor/cursor_Test_quest.psd’);
}
.main-menu-button:active {
-unity-font: url(‘/Assets/[2]Content/Fonts/StandartFormat/OpenSans-Bold.ttf’);
font-size: 33px;
background-color: rgba(0, 0, 0, 0);
color: rgb(135, 116, 39);
border-left-width: 0;
border-right-width: 0;
border-top-width: 0;
border-bottom-width: 0;
border-top-left-radius: 0;
-unity-text-align: middle-center;
display: flex;
cursor: url(‘/Assets/[2]Content/Sprites/Cursor/cursor_Test_quest.psd’);
}
Errors
NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.VisualElementAssetExtensions.AddStyleClass (UnityEngine.UIElements.VisualElementAsset vea, System.String className) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.9/Editor/Utilities/VisualTreeAssetExtensions/VisualElementAssetExtensions.cs:113)
Unity.UI.Builder.BuilderAssetUtilities.AddStyleClassToElementInAsset (Unity.UI.Builder.BuilderDocument document, UnityEngine.UIElements.VisualElement ve, System.String className) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.9/Editor/Builder/Utilities/BuilderAssetUtilities.cs:246)
Unity.UI.Builder.BuilderClassDragger.PerformAction (UnityEngine.UIElements.VisualElement destination, Unity.UI.Builder.BuilderDragger+DestinationPane pane, System.Int32 index) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.9/Editor/Builder/Draggers/BuilderClassDragger.cs:49)
Unity.UI.Builder.BuilderDragger.OnMouseUp (UnityEngine.UIElements.MouseUpEvent evt) (at Library/PackageCache/com.unity.ui.builder@1.0.0-preview.9/Editor/Builder/Draggers/BuilderDragger.cs:531)
UnityEngine.UIElements.EventCallbackFunctor`1[TEventType].Invoke (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Events/EventCallback.cs:64)
UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Events/EventCallbackRegistry.cs:341)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Events/EventHandler.cs:147)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Events/EventHandler.cs:125)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Events/MouseCaptureDispatchingStrategy.cs:83)
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.12/Core/EventDispatcher.cs:373)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/EventDispatcher.cs:336)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/EventDispatcher.cs:299)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/EventDispatcher.cs:264)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/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.12/Core/EventDispatcher.cs:364)
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.12/Core/EventDispatcher.cs:216)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/Core/Panel.cs:411)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/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.12/Core/UIElementsUtility.cs:209)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at Library/PackageCache/com.unity.ui@1.0.0-preview.12/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.12/Core/UIElementsUtility.cs:28)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <6cf4b8f7a4344e9e9df60cc4c1690d8c>:0)
In general you should only have one event system for all your UIToolkit content. The component shows up as “EventSystem (UIToolkit)” in the inspector, and your scene should contain exactly one of them.
Important note: if you do have non-UIToolkit UI (canvases and such), then those also need their own event system to work, which will be a different component, from the UI module, with the same name, so you’ll need to be careful about them. It will show up as simply “EventSystem” in the inspector and it will generally be accompanied by a StandaloneInputModule that goes with it. This is a bit tedious at the moment but we will simplify the interactions between both UI systems starting in Unity 2021.
For now, just treat UIToolkit as its own thing. It needs an EventSystem to work. If you’re using the InputSystem package, then your EventSystem will show up with a few fields to populate, as shown in your screenshot. The InputActionAsset is the most important one. Most projects will only have 1 InputActionAsset, so you can simply assign that one. If you have multiple ones, then choose an asset that matches your choice of input configuration for your UI. At the moment you can’t have different panels use different input configurations, but you can create other action maps to have actions that relate only to your UIToolkit panels if that’s what you want. Simply assign the actions you want to use in the fields that follow: Navigate Action, etc. Make sure you associate actions from the same InputActionAsset though.
If your actions have a name that fits the name of the field on the EventSystem component, then they can be automatically assigned by right-clicking on the EventSystem and selecting “Set Actions to Default”.