How to detect which block is pressed using javascript

Hi I am trying to detect which cube is pressed but the code. I just have 3 simple cubes which act as a button I want to detect which is pressed at what. i am using it does not work properly when ever i click it clicks all cubes using Javascript

#pragma strict

function Start () {

}

function Update () {

if(Input.GetMouseButtonDown(0))
{
var hit: RaycastHit2D = Physics2D.Raycast(transform.position, -Vector2.up);



if(hit.transform.gameObject.tag.Equals("Box 3")){
Debug.Log("hit 1");
}
if(hit.transform.gameObject.tag.Equals("Box 2")){
Debug.Log("hit 2");
}
if(hit.transform.gameObject.tag.Equals("Box 1")){
Debug.Log("hit 3");
}
}

}

Use a Debug.Drawray to check if you are actually shooting the ray where you want to, and also use CompareTag instead of Equals. check the cube colliders and make sure they don’t overlap.