How do I implement Raycast Touch in my 2D Android Game?

Hey guys. Making a small game on unity for android. All I want to do is make a gameObject with a 2D Collider open a new scene when I press it, but My current code does not work. Can anyone help me? I have been stuck with this for about a week and its humiliating considering its something as simple as touch. I have it shoot a raycast with the direction being Vector2.zero, but Can someone please explain it a bit better to me? Here is the code:

function Update () {
    for (var i = 0; i < Input.touchCount; ++i) {
		if (Input.GetTouch(i).phase == TouchPhase.Began) {
			var rayHit : RaycastHit2D = Physics2D.Raycast(transform.position, Vector2(0,0), Mathf.Infinity, 0,-Mathf.Infinity, Mathf.Infinity);
			if (rayHit) {
			print("Touched: " + rayHit.collider.name);	
			} else {
			print("Hit Nothing");
			}
		}
	}
}

My output comes out really weird, All I do is touch along down the screen, and I have 4 buttons, so I should hit nothing a bit, and hit a button once or twice, but It Gives me wrong output, like I touch one button and it gives a different button as the output, or it just says hit nothing when I can clearly tapping the button. I don’t understand what I need to do to fix it…

To detect touches on buttons I suggest a different approach other than the raycast. OverlapPoint is the way to detect if a position is inside a 2D collider. What I usually do (and works pretty well) is:

  1. Whenever I detect a TouchPhase.Began (or a tap or whatever) I send an event with the position of the touch (from a touch input manager, so I don’t need to check for the touches inside all objects).
  2. Inside the button’s code, I check whether the position I get from the event collides with the button’s 2D collider using the OverlapPoint method.

This way, whenever you receive a touch event, each button will tell you if it’s being touched or not.