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
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.
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.
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?
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)…
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.
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?