How click 3d model ..?

Hi :wink:
suppose there is a 3d cube in the center of the scene, all my request:
when click with left mouse over this cube, print “HIT …” is it easy to check that ?
Edit: i found this code:

var aim : GameObject;
function Update () {
    if (Input.GetButtonDown ("Fire1")) {
        // Construct a ray from the current mouse coordinates
        var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        if (Physics.Raycast (ray)) {
            // print "Hit"
            Debug.Log ("Hit");
        }
    }
}

but the problem unity print “Hit” when click ANY 3d model, i want print “Hit” only when click the cube model…

There’s several ways you could do it; the easiest probably being a script on the cube itself with an OnMouseDown function

something like

void OnMouseDown(){
Debug.Log("Hit");
}

Place the script directly on the cube.