One finger touch but got fingerId 1

Hello, I am trying to output all Input.touches in each frame. In the case of a quick click with only one finger, I obtained a touch with fingerId 1 and also a touch with fingerId 0, with a time difference of 1ms or even 0. Sometimes use two fingers can also result in some touches with fingerId greater than 1. I want to know if this is because some touch lifecycles have not yet fully ended, and if there is any solution. Thank you!

From the docs:
“You cannot make any assumptions about fingerId and the number of fingers actually on screen”

The id’s are mainly there to keep track of where a finger moves from one frame to another because the fingerId is kept the same as long as that finger is on the screen

2 Likes

Got it, thanks!

1 Like

Yes, what @venediklee says exactly… think of it just as an identifier to let you reconnect the same touch regardless of where it appears in the array of touches.

If you want to see a simple example of it in action, see my VAButton class here:

Line 88 int fingerId; tracks the finger involved in this VAButton

NOTE: all my code goes through a wrapper class called MicroTouch so that I don’t have to write separate code paths for mouse and touch.