Wrong Input Position After Orientation Change, Results in Unresponsive UI

We’ve had some user complaints where the app running on their Android devices stops responding to UI button presses, but only after some action that causes the app to background and then resume with a screen orientation change.

I was able to reproduce this issue internally using a Nexus 6P, with these repro steps:

  1. Start the game normally (in landscape), go to main menu, tap on a button. It works fine.
  2. Press the power button on the device, which turns the screen off.
  3. Press the power button again, which turns the screen back on, but now on the lock screen in portrait mode.
  4. Swipe to unlock the device, which resumes the game in landscape mode.
  5. Tapping the same button as before is no longer responsive.

Regarding the non-responsiveness, I did some log output of the input position reported by Unity (Input.position), and it seems to be incorrect after this issue occurs. When I first tap on the button, the screen position is reported as (347.0, 234.0). But after the issue occurs, tapping in the same spot reports (613.3, 732.9). So, it is actually possible in some cases to tap in some spot on the screen and have a button elsewhere on screen act as though it was tapped.

This issue is occurring for me in Unity 5.6.5p4, but I don’t think it is necessarily unique to this version.

Unfortunately, I couldn’t get the issue to occur in a new/empty Unity project, but I’m unsure what aspect of my project would be causing this problem (some project/player setting? manifest configuration? some input setting issue?). It also doesn’t seem to happen on every Android device.

One thing I did find is that the screen orientation change seems to be necessary. My game is a landscape game, so this issue occurs since the lock screen switches to portrait, and then back to landscape. If I make a build that runs as portrait, I can’t get this issue to occur.

Has anyone else encountered something like this? Any tips/guidance on what setting or configuration may be causing this issue to occur?

This looks very similar to - Unity Issue Tracker - Android Touch Input becomes offset when rotating device

Thanks for the link, and sorry for not responding more promptly. That does indeed seem like the issue I’m seeing, so I guess I’ll wait until Unity 2019.1 is released to see if the issue is fixed.

One other note I wanted to add is that this issue also seems to occur after making use of the Android “split screen” feature. If you long-hold the “square” app selector button, it enables split-screen mode on the device. Once this happens, I also see this issue with incorrect input positions.

Finally, I noticed that an easy way for the user to fix the problem is to suspend and resume the app…but it’d be great to not require that!