Touch screen move - android

I have code, and in unity editor is done, but emulator doesn’t work, if click anywhere on the screen game off. I have not idea how fix it. Thank you in advance.

private var ray : Ray;
private var rayCastHit : RaycastHit;

function Update () 
{
	if(Input.GetMouseButton(0)) 
	{
		ray = Camera.main.ScreenPointToRay(Input.mousePosition);

		if(Physics.Raycast(ray, rayCastHit))
		{
			transform.position.x = rayCastHit.point.x;
		}
	}	
}

Because this code is only for mouse controls and not for touch …