what is the different between "input.touches.Legnth" and "input.touch"

hi guys
need a help to explain the input.touches for me more …
I am learning coding for touchscreen . I just find the doc said “input.touches” represent a list of all touches at the last frame , then input.touches(i) should be the object represents each touch right ?
then I found another code input.touchCount , this one also can tell me how many touches in the last frame , it looks like same result as the input.touches.Length. then I also find some sample code that they use input.Gettouch(i) to represent each touch .

so my question is what the different function about these touch code when we use it in real work ?
input.touches.Length / input.touchCount
input.touches(i)/input.Gettouch(i)

If you use Input.touches then it has to allocate temporary variables for the array; if you use Input.touchCount then it doesn’t. So you can use that to avoid checking input in more detail if there aren’t any touches.

–Eric

2 Likes

ok~, thanks~ :slight_smile: