Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

Touch.fingerId

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public int fingerId;

Description

The unique index for the touch.

All current touches are reported in the Input.touches array or by using the Input.GetTouch function with the equivalent array index. However, the array index isn't guaranteed to be the same from one frame to the next. The fingerId value, however, consistently refers to the same touch across frames. Use the ID value when analysing gestures; it's more reliable than identifying fingers by their proximity to previous position, etc.

Touch.fingerId isn't the same as first touch, second touch and so on. It's just a unique ID for each gesture. You can't make any assumptions about fingerId and the number of fingers actually on screen, since virtual touches are introduced to handle the fact that the touch structure is constant for an entire frame (while in reality the number of touches might not be true, for example if multiple tappings occur within a single frame).