private void FixedUpdate() { bool leftMoveTouched, leftJumpTouched, rightMoveTouched, rightJumpTouched; leftMoveTouched = leftJumpTouched = rightMoveTouched = rightJumpTouched = false; instance.touchList = Input.touches; Vector2 touchPosition; //if (touchList.Length > 0) print(touchList[0].position); for (int i = 0; i < touchList.Length; i++) { touchPosition = touchList[i].position; if (instance.leftMoveData.InRange(touchPosition)) { leftMoveTouched = true; //print("Left move button is pressed!"); continue; } else if (instance.rightMoveData.InRange(touchPosition)) { //print("Right move button is pressed!"); rightMoveTouched = true; continue; } else if (instance.leftJumpData.InRange(touchPosition)) { leftJumpTouched = true; //print("Left jump button is pressed!"); continue; } else if (instance.rightJumpData.InRange(touchPosition)) { rightJumpTouched = true; //print("Right jump button is pressed!"); continue; } } leftMoveData.UpdateData(leftMoveTouched); leftJumpData.UpdateData(leftJumpTouched); rightMoveData.UpdateData(rightMoveTouched); rightJumpData.UpdateData(rightJumpTouched); }