Arugument Out of Range - touchScreen

Hi, I’m working on making a multi touch screen game (basically simultaneously moving multiple cubes around the screen with multiple fingers). I have it working, and I am able to move multiple objects - however when I’m moving more than one cube (say two cubes with two fingers) I get this error:

ArgumentOutOfRangeException: Argument
is out of range. Parameter name: index
(Int32 index) (at
buttonTouch.OnTouchMove () (at
Object, SendMessageOptions)
touchInput:Update() (at

And yet it still functions and works?! The same error happens if I move three cubes or four cubes, but it doesn’t occur when I am moving just one cube.

I’m pretty sure that the bug exists here within the FOR loop or the fingerPosition variable - but I’m not sure and I’ve tried everything. Please help! This is really bugging me.

you’re iterating touchCount times and you’re using i for accessing touchManager array. they’re of different size.