Search Unity

Touches missed on iOS

Discussion in 'iOS and tvOS' started by GamaGui, May 15, 2012.

  1. GamaGui

    GamaGui

    Joined:
    Apr 21, 2012
    Posts:
    15
    I am having a lot of trouble getting touches to be consistent on iOS. This code works about %90 of the time. The rest of the time the touch is ignored. Using just one finger.

    Code (csharp):
    1. var tapCount = Input.touchCount;
    2.     for ( var i = 0 ; i < tapCount ; i++ ) {
    3.        var touch = Input.GetTouch(i);
    4.        if (touch.phase == TouchPhase.Began){
    5.                 print ("touch y is " + touch.position.y);
    6.         }
    7. }
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    is it in Update() ?

    What framerate?
     
  3. GamaGui

    GamaGui

    Joined:
    Apr 21, 2012
    Posts:
    15
    Yes, in Update(). I didn't check the framerate. With it in Update() any touches should get detected shouldn't they?
     
  4. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    And this is on the actual device? Note that Unity Remote sometimes misses touches that don't cause problems on the actual device.
     
  5. actuallystarky

    actuallystarky

    Joined:
    Jul 12, 2010
    Posts:
    188
    I've always had issues with touch.phase and only get solid touch / swipe recognition when I manually track touches through Input.GetTouch()

    But that might just be me.
     
  6. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Your code should not rely on TouchPhase.Began phase, because if your framerate is low and touch is quick (read starts and ends on the same frame) then only TouchPhase.Ended will be reported.
     
  7. GamaGui

    GamaGui

    Joined:
    Apr 21, 2012
    Posts:
    15
    OK. I'll keep working at it to see what works best.