Bug: Unity InputManager sets Horizontal/Vertical input value on Window Focus
I am working in Unity 5.2.3 on a Windows 7 machine. I have a simple test game using the Unity standard "InputManager" to control a character but I have found a strange issue. Sometimes, if the game window loses focus and then regains focus, the value for Horizontal and Vertical input (for the Joysticks) will be set to -1 or 1 instead of 0. This makes the character start moving as soon as the game window regains focus, in some cases. This is happening in both the Unity Editor and in a standalone .EXE. I am changing focus by using "alt+Tab".
This issue is intermittent, and I can reproduce the bug about 50% of the time I hit "alt+Tab". Once the values are pinned to -1 or 1, they never reset back to 0, even if I use the keys to move around. I have seen other posts about this issue going back for years, but no definitive answer. Please advise.