I check to see if there are any joysticks connected when my game starts up by using Input.GetJoystickNames(). In the Editor, and in a regular Windows build, Input.GetJoystickNames() is immediately populated.
in a UWP build running on Windows, though, it is empty when I first check it in a MonoBehavior Start() method. It does later get populated. Is there some reason that this information is not available immediately on startup (assuming that the controller is already connected, of course)?
It definitely cause me trouble, since I do all of my UI setup on startup (deciding whether to display keyboard or button controls, for example). I was able to work around it by restructuring things so that I don’t initialize my game until a few frame updates happen.
Keep in mind that if you do it like that, your game interface will be buggy if a gamer plugs in a controller mid game. Most games avoid this problem by displaying keyboard controls initially and only switch to controller controls if it detects input from the controller.
Definitely - I am being lazy and not adjusting to a controller being added mid-game (the controller will still work, it just isn’t represented in the UI).
Still, I think this is an issue that should be addressed, if possible. I have submitted a bug report.