We recently upgraded our project from 3.10.2 to 3.11.4.
Our game runs on Android and iOS handheld devices as well as on PC and Mac via Steam.
After completing the NGUI upgrade process and releasing our game update, we received several report that our mobile interface on Android and iOS would convert incorrectly and show our PC interface. We have logic in place that detects user input and displays the appropriate interface accordingly. In fact we have even supported devices like a Surface tablet where the user could be using touch, then attach a keyboard and mouse and successfully continue playing with the correct PC interface.
Suddenly now after the 3.11.4 update, we're seeing our intended behavior is not working correctly. After some testing, we've detected that the UICamera.currentScheme property returns Mouse incorrectly when exclusively using Touch only. We tested this on a Nexus 7 and Google Pixel and both would find that the currentScheme would switch to Mouse on every alternate touch. This could then lead to an unintended UI change on our end when our logic looks to currentScheme to determine the layout.
You could see how a check like this would fail if the currentScheme value was no longer Touch.
if (UICamera.currentScheme == UICamera.ControlScheme.Touch)
ControlScheme = ControlScheme.HANDHELD;
else
ControlScheme = ControlScheme.PC;
I tracked this down further and found that the switch to Mouse seems to originate in the ProcessMouse() function of the UICamera class around line 2157, when the sqrMag value check doesn't return. Instead logic proceeds and the currentKey is set to KeyCode.Mouse0. This seems to then convert the Scheme to Mouse shortly afterward and everything gets messed up.
In NGUI's previous version this switch to Mouse doesn't occur. We tried to diff the code to figure out what's up, but haven't quite been able to pinpoint the issue. Any help here would be great.
We haven't made any other changes that would affect this logic and we've been using all of the Event Sources below successfully for a long while now.