Hi!

I'm making an Android game in Unity3D. The game is about hitting virtual 
buttons on screen at the right time. Sometimes, the buttons are adjacent to 
each other and user has to press more than 1 button, say 2 at once or one 
after another.

I've ran into a problem where on some devices it was really hard to press 
those adjacent buttons. The first button I would hit would always register 
correctly but the second button not always registered a hit. After doing a 
thorough investigation and profiling of my code I assumed it must be 
outside of the scope of my code. I turned on Android's built-in input 
debugging overlays and did some digging. Here's what I found.


A single tap in my game looks like this:

[image: single_tap.png]

The red circle with screen coordinates are objects inside my game 
(simplified here to demonstrate  the issue). The coordinates 901x204 are 
the coordinates of the pixel hit in game, starting from lower left corner. 
Beneath the circle is a small red dot - that's Android's built-in touch 
indicator which can be enabled in developer settings of the operating 
system. The big, red ingame circle is placed directly above the Android 
touch indicator - so that they don’t overlap.


This is how a multi-touch input (double tap) looks like:

[image: double_tap_far_apart.png]

Two dots, two circles, so far so good.


Now, if I would touch the screen with my middle finger first (the right 
side below), then quickly followed by a touch with my pointer finger (left 
side below), this is how the input looks like most of the time:

[image: double_tap_close.png]

So what just happened? My game got two touch events, as indicated by the 
red circles with coordinates. They are in the correct position. But the 
Android's touch indicators look weird. What happened is that the moment I 
touched the screen with my pointing finger (left side), the system thought 
for a split second, that I was dragging my middle finger. The system 
quickly realized that it's actually a second touch and fired a second touch 
event where it should, meanwhile dragging the middle finger back to it's 
position. This introduced a slight delay to the secondary touch but is 
bearable.


Now, some of the times, when I touch with two fingers close by, instead of 
the situation described above I get this:

[image: double_tap_broken.png]

I did exactly the same thing as I did previously: middle finger touch 
quickly followed by a pointing finger touch close by.

As you can see, the game registered two hits in almost exactly the same 
position. The Android touch indicators show a single touch (small red dot 
below the drag line) for the middle finger and a drag originating from the 
middle finger position to pointing finger position. This problem makes my 
game unplayable on certain devices.


Now that I'm aware of the problem and I understand what's actually going 
on, I can potentially solve it inside my game, e.g. by making my in game 
buttons responding not just to touch events but also to drag events. Such a 
solution won't be perfect though, it will make the game playable on the 
affected devices but it will introduce input delays which negatively impact 
UX.


Given the above, I wonder what is this behavior caused by? Is this an 
Android bug? Faulty device? The input sensors not precise enough? 


Or is it actually an intentional Android input optimization that makes 
sense for normal applications? If so, is there a way to turn this 
optimization off?

Has anybody ever experienced similar problems? Is there something I could 
do about this issue other than trying to do the aforementioned in game fix?


Thanks in advance,

Bartosz

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/932b63c0-55fb-4e21-9271-ed723a4b7c86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to