Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


fingerId

The unique index for the touch.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.InputLegacyModule
public int fingerId { get; set; }

Remarks

All current touches are reported in the _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.
_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).