Can't interact with buttons on build.

Unity 2022.2.0b8
Experimental Packages : Entities 1.0.e8
Input Handler : Both

Button can be clicked in the editor, but not on build.
Also cannot change focus on buttons using tab/arrow keys.

It works previously on 2021.3.10f1 LTS, both Editor and Build.

Is there some build settings I am missing?

Oh, same here Editor works perfect, Build is broken. I also tried 2022.2.0b8 and 2022.2.0b9.

I tried to register some Callbackhandlers: I figured out, that:
MouseOverEvents are working fine
MouseDownEvent Not firing
MouseUpEventNot Not firing
ClickedEvent Not firing

It seems its not just buttons. I played a bit around with a Lable, there all the events were not fired. Textboxes are also completely broken. So no idea, why just the MouseOverEvent of the button works :frowning:

1 Like

Fixed/Workaround: I found, that there is a DefaultEventSystem used to fire the events in the editor. It seems, this is broken somehow for the new Unity Version.
=> I added next to all of my UiDocument a StandaloneInputModule Component from the UI Framework and its worked again.

1 Like

HI guys, can one of you log a defect with the project and let us know the ticket id?

Hi Gekigengar,

The philosophy we have in UIToolkit for now is that if you want to use the new Input in your project alongside UIToolkit, you have to go through UGUI’s EventSystem (see Unity Manual here), because at the moment we’re not directly integrated with the new Input. That being said, we are actively working on completing that direct integration in the near future.

However, it’s true that having a certain behaviour in the Editor and not in the Build is problematic. I confirm from testing your setup that, indeed, when in a Build and using Active Input Handling = “Both” with only a UIDocument on the scene, no PointerDownEvent, PointerUpEvent, ClickEvent, MouseDownEvent, MouseUpEvent are received.

Oddly enough, I’ve found that adding a script with an empty OnGUI method seems to fix the problem.

using UnityEngine;

public class ScriptWithEmptyOnGUI : MonoBehaviour
{
    void OnGUI()
    {
       
    }
}

I’m pretty sure the problem comes from some optimization in our Build code that detects there’s no GUI active in the game, and seeing that the new Input is also present (because you have “Both” selected) it probably discards the old input events. On the other hand UIToolkit detects that the old input also available and it tries to consume the GUI events, which aren’t there.

In all cases, what you get in the Editor and what you get in the Build shouldn’t differ by that much of a margin, so I think we can treat this as a bug despite your setup not being officially supported right now. Like Pierre said, if you can log a bug we’ll do our best to come up with a fix as soon as possible.

1 Like

Sorry for the late reply, thanks for acknowledging and investigating the issue! I was worried this is not logged because its never in the “Known Issue” among the patches, and there are currently 3 threads about the same issue with no replies.

I guess I will be using the workaround until this is fixed on later patches!

The project is gigabytes in size, I will need to decouple a lot of things and create a new project to create an isolated environment for this specific issue. But it seems like uBenoitA has been able to reproduce the issue with the current setup. Is it still needed?

But it seems like uBenoitA has been able to reproduce the issue with the current setup. Is it still needed?

No, it’s alright, here’s my simple repro in case anyone else needs it. We can create a ticket internally, no problem.

8555663–1144214–TestUITKMouseEventsBuild.zip (42.1 KB)

1 Like

Yup it’s fine, i’ll log something on our side and reply with the ticket number.

Here’s the link for it: Unity Issue Tracker - [UI Toolkit] Mouse events not triggered in build when Active Input Handling is set to both

1 Like

This is still happening in the latest version of Unity 2022.2.16: Simply create a new project, install the Input System package (in my case it was the latest one, 1.5.1), change the Active Input Handling to the new input system (from player settings), create a button that enables, for example, an image on click. build to Android and when you press the button it will remain in the clicked status without enabling the image …
It works fine in the Editor but not on the device.
I tried everything mentioned in this discussion but never succeed.
This is very annoying because I can’t test my app (I want to use the new Memory profiler that is only available in Unity 2022)…

Noticed a missed step there, is the Event System configured to use the new Input System?

8976967--1234609--inputsys.png

Yes, it is configured correctly. I would like to mention that I am using a Mac, so my version of unity is the Silicon one.

No resolution for this? I have this very same issue.

My issue was solved by this fix: Unity Issue Tracker - [UI Toolkit][Android][Mouse][Touchpad] UI Toolkit is not interactable when using mouse or touchpad

Bug still there but simply adding StandaloneInputModule worked for me

I was having the same issue but none of the fixes here worked for me. I finally resolved it when I noticed that Supported devices in my Input System Package settings only had Keyboard listed. I’m pretty sure I didn’t change it to this, so at some point Unity did it.

Removing keyboard and leaving the list empty per the description above the field, resolved my issue.

Greetings. How did you add the Standalone Input Module? When I add it, it also adds an event system. I tried to add it (the Stand Alone Input Module) to each UI Document object but then I got the error that there were too many event systems in the scene.

On what object should this be added? Should this be added on the main camera or any object in the scene?

When I tried to add a Stand Alone Input Module to each UI Document, it told me that I had too many event systems in the scene. It seems the Stand Alone Input Module requires an event system for it to operate. How did you add yours?