Not Hitting a button with raycast

Good Evening,

I’m developing a game for android. I have several UI buttons and I’m already checking if the button is been touched. The button has a BoxCollider2D, and every time I touch the button it recognize the touch, but the Physics.Raycast is always false. The Script is attached to the Main Camera. Does anyone can help?

using UnityEngine;
using System.Collections;

public class ButtonController : MonoBehaviour {

	private GameObject objectHit;

	// Use this for initialization
	void Start () {

	// Update is called once per frame
	void Update () {
		if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began) {
			Ray buttonRay = Camera.main.ScreenPointToRay(Input.touches[0].position);
			RaycastHit buttonHit;
			if (Physics.Raycast(buttonRay,out buttonHit)){
				objectHit = buttonHit.transform.gameObject;

Are you using a canvas? Make sure that the Raycast Target option in Image Component of the Button is checked. But why are you using Raycasting for button clicks? You can just use the OnClick() Listener in the Button Component to call methods you want.

If found an answer. This script is attached to the main camera.

RaycastHit2D buttonHit;
			buttonHit = Physics2D.Raycast(this.transform.position, Input.touches[0].position);
			if (buttonHit)
				objectHit = buttonHit.transform.gameObject;