Detect touched 2d object in Unity3d 4.3

Hi, How to detect 2D object in unity 4.3, I have tried code which following mentioned but it gets crash because I think this is for 3D objects. Could you please help me on that how can I detect 2D Object(name or tag) if user tap on object. I have all 2D Objects. Here is my code what I am doing to detect name of objects.

if (iPhoneInput.touchCount == 1 && iPhoneInput.touches[0].phase == iPhoneTouchPhase.Began)

	{
		
		Ray r =  camera.ScreenPointToRay(new Vector3(Input.touches[0].position.x, Input.touches[0].position.y, 0f));
		
		
		RaycastHit hit0;
			
			switch (hit0.transform.gameObject.name)
				
			{
				
			case "char_enemy_alienSlug-dead":
				
				hit0.transform.gameObject.SendMessage("BubbleTouched", SendMessageOptions.DontRequireReceiver);
				
				break;
				
			case "char_enemy_alienShip":
				
				hit0.transform.gameObject.SendMessage("Touched", SendMessageOptions.DontRequireReceiver);
				
				break;
				
			}
			
		}
}

Kindly help me on this, I used Ray2D and RaycastHit2D but it also didn’t work out. Kindly share with me bit code to detect object name or tag which is touched. Thanks in advance.

Whether you are 3D or 2D, you have to actually cast the ray using some form of raycast either Physics.Raycast() or Physics.Raycast2D(). Just creating a ray doesn’t initialize the RaycastHit structure. For this use, you want the 3D version (RaycastHit/Physics.Raycast()). And the raycast is not guarenteed to hit anything, so you need to check. See Raycast examples:

http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html