x


Android: Touch Input Timeout Issue

We have a game on the Android Market and it is plagued by an issue with the touch input. In the game you have to hold the accelerator button to drive. The problem is that after 32 seconds (on my device) all touches get cancelled. This is a known issue as some reviewers have given us a bad review on the market for it. This page was all I could find on the internet about it:

http://www.xoomforums.com/forum/motorola-xoom-general-discussion/4638-touch-input-timeout.html

This means that after you have held down the accelerator for 32 seconds, it cuts off and you have to press it again to continue driving. I have tested this in a completely blank project so I know it's not our project at fault.

You can try it for yourself: Just dump this script in an empty scene, run it on Android and hold the screen for 32 seconds or so. If your phone has the same issue, the touch count will reset itself to zero, cancelling all active touches.

function OnGUI() { GUILayout.Label("Touch count " + Input.touchCount); }

more ▼

asked Dec 21 '11 at 06:41 PM

Eugene gravatar image

Eugene
31 2 2 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Depends on how your code is implemented.

A good approach would be to to only react on certain touch phases. I.e. start accelerating if Input.touches[0].phase==TouchPhase.Began and stop only at Input.touches[0].phase==TouchPhase.Ended.

If an Input.touches[0].phase==TouchPhase.Canceled happened (which probably happens when you time out), you have to decide what to do (i.e. notify the users that he has to retap, or simply ignore it and have the car continue to accelerate).

more ▼

answered Dec 21 '11 at 08:56 PM

Tseng gravatar image

Tseng
1.5k 6 8 23

I tried something similar to this already but there were a couple of problems. The first you already mentioned is where the end phase is never fired when the touch is cancelled. The accelerator will essentially be "stuck" down until the player lifts their finger, touches the screen, then lifts their finger again.

The second problem with is that when the first touch is cancelled, any subsequent touch becomes the first touch. So I am holding the gas, it gets cancelled by the OS, I press another button which overwrites the first one and the gas gets cut off.

If this is a problem with the Android OS I am surprised there is not more information about it. I have done a lot of searching on Google and found nothing.

Jan 04 '12 at 01:19 AM Eugene

Anybody? This is kind of a deal breaker.

Jan 21 '12 at 10:31 PM Eugene
(comments are locked)
10|3000 characters needed characters left

if Input.touches[0].phase==TouchPhase.Canceled, intelligently persist the EFFECT of the touch using the coordinates of the canceled touch. Remove the effect of cancelled touch if total touchcount becomes > 1 as that means they have touched somewhere else.

more ▼

answered Feb 06 '12 at 04:52 AM

buffonomics gravatar image

buffonomics
36 1 3 4

The accelerator will essentially be "stuck" down in this state.

Feb 06 '12 at 09:43 AM Eugene

Well then I guess you have to incorporate this into your gameplay somehow. Acceleration lock = hyper speed. :)

Feb 06 '12 at 06:00 PM buffonomics

I think I'm going to submit a bug report to Unity. I think this is actually a problem with the Android OS itself but there has to be some way to fix it.

Feb 06 '12 at 06:20 PM Eugene

I don't think Unity can do a thing about it if it's an Android OS bug. Unity is simply a layer on top the OS and reports to you what the OS tells it. You would be better served submiting a bug to Google :)

Feb 06 '12 at 06:32 PM buffonomics
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2608
x980
x606
x529
x16

asked: Dec 21 '11 at 06:41 PM

Seen: 1584 times

Last Updated: Feb 06 '12 at 06:32 PM