[UWP] Xbox controller not working until UI used with mouse first

[RESOLVED]

It turns out I was loading another EventSystem object elsewhere, and it was interfering with the main one. The problem only manifests with a gamepad/keyboard (i.e. it works 100% fine with mouse and touch) and only when I start my game from the main menu, which I usually don’t while developing!

So…only have 1 EventSystem!


It seems my Xbox controller is not working with my UI until I interact first with a mouse (e.g. clicking a button). Then the controller input starts to be recognised. This is obviously a huge blockage for testing on the Xbox One…

  • I had this working previously by simply setting the First Selected to a button in my UI in the EventSystem object, but this doesn’t fix the issue
  • I have set ‘Force module active’ to true in EventSystem (and also tried it as false)
  • Controller buttons are being recognised, as I can hit the Start button and bring up my pause menu, however I cannot navigate between UI elements to select them
  • I get exactly the same results with an Xbox 360 controller on the PC and an Xbox One controller on the actual console (same UWP build)
  • UWP build is D3D
  • I’ve tried forcing the EventSystem to select a UI button at runtime, but this doesn’t seem to affect anything
  • Controller input works exactly as expected when running the game in the Unity editor
  • Unity 5.5.0f3

Is there anything special I need to do with UWP builds? It was definitely working before but I haven’t tested for a while.

How did you figure out you were loading a second event system? I am having this same issue, it works perfectly in Visual Studio and in the Editor, but as soon as I get it into Xbox One I don’t get any controller movement. However, the first UI button is active/highlighted like I want it to be.

Note: When building the XAML version I not only had the Xbox mouse cursor visible, but also a large white outline around the whole screen. Not sure which is easier to solve for, but I had thought I read building D3D would fix both. It seems to have fixed both, but now I can’t move through the UI at all.

I also double checked to see if a second event system was loading, but I only see the one. Now, I have one on each scene, but they don’t carry through when a scene changes, so I don’t understand what the issue is.

Can we get a bug report on this with a repro so we can investigate? I don’t think we have any known issues WRT this.

It looks like turning on the “Force Module Active” checkbox within the EventSystem seems to have fixed my problem on my initial main menu. So, built as D3D and the mouse didn’t show up on Xbox One, but still appears within Windows (which is good for my project). Will see if my other screens are fixed by the same toggle.

3 Likes

Similar issue here w/ Unity 5.5.2f1.
I tried to use XBOX 360 controller to control the menu. However, if the player use the mouse to click the screen in editor or release build, the XBOX 360 controller can not control the menu anymore.
I have tried to ignore all raycast and turning on the “Force Module Active” as nyarsulik but no any luck.
Any ideas?:frowning:

Clicking on the screen anywhere but on a Selectable is causing all Selectables to be deselected. If no Selectable is selected, controllers and the keyboard cannot be used to control the UI. You must select some UI element again if that happens.

These are relevant:
https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem-currentSelectedGameObject.html
https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.SetSelectedGameObject.html

1 Like

Hi there!
Does anyonne have ovecome this issue? Im also into this problem and will apreciate if someone gives aditional hints :slight_smile:

Arcanebits

1 Like

You can hack it by making a script that checks the EventSystem’s current selected game object in Update(). It should have a variable for previously selected object. If none is selected, that means you clicked somewhere that wasn’t a selectable like Guavaman said. It should simply reselect the last selected item. If there’s a better solution, I’m all ears.