Input.GetTouch(index) is NOT the fingerID

Hello guys. I have the next issue:

On my game, I check if a touch is inside a zone and if it does, I save its fingerID in a variable, let’s say finger, so that I can get its position on every frame.

The problem is that when I use Input.GetTouch(finger) I realized that the touch index is not always the finger id.

How do I know that? If I touch (finger index 0) and again (finger index 1) and then release the first one (index 0), the finger index 1 now is the 0, but it keeps its fingerID number (1) so it is the touch index 0 and finger id 1.

The question is, is there a way to make reference to the touch by its finger ID instead of its index?

Sorry if my English is not good…

No, there is no direct way of doing this.
What you can do is create a wrapper class of Input and have a dictionary of type { int fingerid, Touch t } which is updated by wrapper class for each update and use dictionary[touchid] whenever you need to access the touch.

I run a loop in touches array and find the new touch with the same fingerid in every frame. I know it’s not efficient but it’s reliable if you want to track a unique finger.

GetUpdatedTouch(int fingerIdAtStart)
{

foreach(var touch in Input.touches)
{
if(touch fingerid==fingerIdAtStart
return touch;
}
return default;
}