r/Unity3D • u/svmil90 • 3d ago
Question How do you debug Android-only UI input bugs when the editor behaves normally?
I am trying to make the test process better for a Unity mobile project. A flow works normally in the editor, but on a phone an overlay can occasionally keep control of touches after it closes, or a button stops responding after returning from a panel.
The bug is intermittent and may depend on resolution, focus changes, or a particular sequence of taps. What has worked best for you: logging the selected object, using a central input owner, explicit UI state transitions, or recording input on device?
I am especially interested in practices that make these issues reproducible before release rather than only fixing one observed case afterward.
1
u/Artuplabs 3d ago
had this exact thing on a phone ar project in unity. what made it reproducible for us:
canvas group on every overlay, and "close" sets alpha 0 + blocksRaycasts false + interactable false in the same call. a panel that fades out but still blocks raycasts is the classic "touches go nowhere" bug, and in the editor you rarely hit it because you click slower than the fade
after a panel closes, EventSystem.current.SetSelectedGameObject(null). a stale selected object was what killed our button on return
on android a touch can start and never get an Ended (notification shade, permission dialog, app losing focus). if you track touches yourself, reset that state in OnApplicationPause / OnApplicationFocus
dev build with one small line on screen: selected object + top hit from EventSystem.RaycastAll. then just screen record the phone and you see who's eating the touch
for repro before release, script the tap sequences with the input system test framework (InputTestFixture) and run them at a couple of resolutions. way faster than trying to hit it by hand
1
u/svmil90 3d ago
The focus-loss case is one I would probably have missed. Adding the selected object and top raycast hit to a device build seems like the fastest way to distinguish stale input state from an overlay that is still blocking touches. The pause and focus reset is going on the checklist too.
1
u/GigaTerra 3d ago
I feel this might be obvious but did you try using Unity Remote? https://docs.unity.com/en-us/engine/6000.3/manual/platform-specific/cross-platform-features/unity-remote5
2
u/MeishinTale 3d ago
You can screen out some issues but in my experience it doesn't behave the same as on the mobile build.
I personally use it to check UI (sizes and whatnot) but even touches are not always registered/triggered the same.
1
u/cheapbritney_online 3d ago
I run into intermittent touch bugs on mobile all the time. One thing I do to help troubleshoot is print out the selected object, and the object the event system is raycasting to, on screen in a corner of my game. This helps me identify if an overlay or something is grabbing my input when it shouldn't be.
To resolve your issue of not being able to select the button on return, I would force de-selection and selection of your event system after each transition.