Enabling MultTouch

I thought the code below would implement multitouch but am told it registers only one finger down at a time. I am assuming that each finger when touching enables the touchphase.begin and will implement the code in the loop for all touches in the array. I do not have a device to test on so I set the useMouse variable true for iterative testing and false when I compile for it to be tesed on a device that is touch enabled.

var useMouse : boolean;
var levelCtrl : LevelController;

    function Update () {
    	// Code for OnMouseDown in the iPhone. Unquote to test.
    	var hit : RaycastHit;
    	if (!useMouse) {
    		for (var i = 0; i < Input.touchCount; ++i) {
    			if (Input.GetTouch(i).phase == TouchPhase.Began) {
    				// Construct a ray from the current touch coordinates
    				var ray = camera.ScreenPointToRay (Input.GetTouch(i).position);
    				if (Physics.Raycast (ray,hit)) {
    					print (hit.transform.gameObject);
    					var hexagonName = hit.transform.gameObject.name;
    					levelCtrl.FlipTileToObverse (hexagonName);
    				}
    	   		}
       		}
    	} else if (Input.GetMouseButtonDown(0) && useMouse) {
    		ray = camera.ScreenPointToRay (Input.mousePosition);
    		if (Physics.Raycast (ray,hit)) {
    			//print (hit.transform.gameObject);
    			hexagonName = hit.transform.gameObject.name;
    			levelCtrl.FlipTileToObverse (hexagonName);
    		}
    	}
    }

Like robertbu said, your code would work just fine. A touch only have the state “began” for one frame. It’s quite unlikely that you manage to have two touches at the same time, but you have to iterate over all touches anyways to get all new touches. Old touches (which still have the finger on the screen) are still there, but have the state “stationary” or “moved”. If the finger got lifted you will get the state “cancelled” or “ended” for one frame. After that frame the touch count will be reduced by 1.

So your code should work just fine.