Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Drag delta issue on new touches on iOS

Discussion in 'Input System' started by ADNCG, Dec 24, 2020.

  1. ADNCG


    Jun 9, 2014
    On every new touch, the touch position isn't updated until the finger has traveled a certain distance. I assume this is because, somewhere along the way(unity or apple?!?!), there's an attempt at gesture recognition and no value is returned until it is confirmed that whatever gesture is not happening.

    To reproduce this issue, print the delta values from a given touch on an iOS device. Move your finger very slowly across the screen. The delta remains at 0 until some distance is crossed, then updates with a high value (15-30px) followed by what should be normal deltas of 1 pixel for the rest of the touch. The issue occurs on every new touch.

    This happens on the old input system and also on my latest attempt with the higher level API of the new input system. I assume it'll happen with the lower level API as well, I'll be giving a shot to that today.

    I have tested many iOS games to see if they experienced this issue and most of them did. I've however stumbled upon a title that did not, meaning it's possible! Now were they using Unity? No idea.

    If someone actually knows if my theory that gesture recognition is happening before input values are returned is correct, and where it occurs(Unity or Apple), I'd be really thankful if you could share that information. I'd like to know where I need to focus my efforts.

    EDIT: After further research, I've noticed the problem occurs in Uber Eats and Fitbit iOS apps, most likely confirming that this is a native problem.

    For regular applications, I assume this is convenient. However, in my use case, I really needed drag input to be as precise as possible. The user's repositioning their finger a lot, thus making the issue very noticeable. It's a shame I know absolutely nothing about native iOS development.

    I'll be researching what can be done over the next few days, if you have expertise in that area, please chime in.

    EDIT2: I found a band-aid. It's not perfect but feels much better. On every new touch, instead of passing the delta as is, I'm clamping the first delta that isn't 0 between -1 and 1, avoiding the huge value that came with the issue. This is good because a delta of 15-20 pixels when the finger is moving very slowly is something very noticeable for the user. The solution is still not perfect because the sum of the deltas is not equal to what the user has provided, but it's more than good enough and unless the users know specifically what they're looking for, it's almost impossible to notice.
    Last edited: Dec 26, 2020
    crandellbr likes this.