Hi.
I read that the “foreach” can cause lag on phones
foreach (Touch touch in Input.touches)
This method should work better(forgot why)
for (int i = 0 ; i < firstArray.lenght ; i++)
firstArray*.something = something else//modify…*
I’ve been trying to convert this code that handles touch, into using the for statement instead of foreach but without success
Here’s the code that I need to change:
if(Input.touchCount > 0)
{
-
foreach (Touch touch in Input.touches)*
-
{*
-
Vector3 inputGuiPosition = touch.position;*
-
inputGuiPosition.y = Screen.height - inputGuiPosition.y;*
-
if(inputGuiPosition.x > Screen.width / 5)*
-
{*
-
_jump = true;*
-
}*
-
}*
}