I’ve been testing some networking stuff in my game, so I have multiple instance of my game running at once. In addition, I have my player Input Actions set up for use with gamepad and keyboard input. The weird thing going on is that my gamepad joystick input registers to all instances, but my keyboard only registers to the focused instance. Currently, I’m fixing the problem through script with Application.isFocused
to ensure that only the focused instance gets input. Is this a bug with the new input system, or a feature…? Thanks in advance!
Do you have “Run in Background” enabled in the player preferences? ATM it’s entirely keyed to that. If it’s enabled, the input system will keep running as part of the player loop and keep processing input of devices that are able to receive input without focus (keyboard and mouse no).
Disabling that didn’t seem to help. In the Player Settings, right?
So, been looking more into this and found that unfortunately there’s some part of Unity (probably PlayerConnection) that is forcing Application.runInBackground on in development builds. In release builds, this works as expected and designed.
After 1.0, I think we’ll have to take another look at this and maybe introduce an explicit switch for forcing input off regardless of Application.runInBackground. Though at the same time it also strikes me as rather poor that there’s some internals in Unity that just override the player setting like that.