UI via Xbox controller get double inputs in UWP

When I press a UI button via the Xbox controller in my UWP builds, it often acts like I’ve pressed multiple times. This happens in UWP builds, but not standalone builds, nor in the editor.

For example, I will select the Play button from my main menu and press ‘A’ on the controller. The game will navigate to the next screen, but it will interpret another press of ‘A’ and choose the first option on that screen (which happens to be the option to return to the main menu).

I have tried using a single EventSystem that persists through all scenes, and I have tried using a different EventSystem in each scene with UI, and I get the same behaviour regardless.

I set the ‘First Selected’ object for each scene as without doing so my game will not recognise controller input until some other input has given the EventSystem focus (e.g. the mouse).

I’ve tried adjusting the Repeat Delay to 1 second, which changes nothing.

Is there something I’m doing wrong in my approach?

I’m using Unity 5.5.0f3 and the latest retail build of Windows 10.

I’ve made a small repro project. In this project if you run in the editor it works as you’d expect. But build and run a UWP version and the button press will repeat and send you back and forth between the two scenes:

https://drive.google.com/file/d/0BzSVcfbrSparRWZXNUx0Q0NyTkE/view?usp=sharing

Sounds like a bug. Could you submit a bug report?

Thanks. I’ve submitted a bug report.

In the meantime is there anything you could suggest to work around this? I am giving out beta copies, and players can’t navigate the menus properly.

Is there a way to make UI input only happen on button release rather than when the button is down? I suppose I could try disabling the EventSystem for a small amount of time at the start of every scene, so if the player has just tapped to navigate there it will ignore input long enough for the player to have released the button.

@pumpkinszwan1 - did you ever come up with a reasonable workaround for this? We’re still seeing this behavior in Unity 5.5.2f1 for UWP builds.

@ReactDev I did come up with a workaround. It’s not particularly elegant, but it works.

I basically implemented my own input delay. In any method that handles a UI button press I check that it has been at least 0.5 seconds since a button press was last handled. I keep track of the time of the last press in a globally available variable.

pseudo code:
void UiButtonPress()
{
if(Time.time - timeOfLastButtonPress >= 0.5f)
{
HandleButtonClick();
timeOfLastButtonPress = Time.time;
}

}

@Aurimas-Cernius - is there a fix for this planned? Our input system is not in a good place for hacking in something to get around a Unity Windows 10 bug.

@pumpkinszwan1 do you happen to have the case # for the issue? I don’t think it landed to our issue grabbag (or perhaps I missed it).

@ReactDev if you have another solid repro, please submit a bug report yourself too (and tell us the case #!). This sounds like a serious issue that we’d want to fix.

Here’s the link:

https://fogbugz.unity3d.com/default.asp?875834

FYI: bug is still present in 5.6.0f3

Thanks!

Hey I just fixed this yesterday. Basically what happens is that our “button down state” is reset on scene load, and once the scene loads, it thinks the button was pressed during the first frame, while it was actually held down. I’ll get this into a patch release soon.

2 Likes

Awesome, thanks!