Is there something like clicked.gameObject?

Is there something like clicked.gameObject? (like col.gameObject)

Because I want to check the tag of the gameObject I clicked and do something with it.

EDIT: added script:

I'm trying to make it so if clicked tag is chopstik then selected = true. I know I'm not doing right though. How would I do it Properly?

function Update() {
if (Input.GetButtonDown("Fire1")) 
{
    var hit : RaycastHit;
    if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit))
    {
        Debug.Log(hit.collider.tag);
        if(hit.collider.tag == "Chopstik") {
            selected = true;
        }
     }

 if (Input.GetMouseButtonUp (0)) {

    selected = false;
    print("deselected");
 }

}

}

Since your click events are handled via a collider, you can check the collider component's game object by Collider.gameObject property. That returns a reference to the Game Object in which your Collider component is attached to. From there, the Game Object has a public property GameObject.tag which will return the tag of that object.

something like this:

function OnMouseDown():void { var clickedTag:String = collider.gameObject.tag; }

EDIT:

What you're doing wrong above is tracking in the Update. You don't need to. All of the info you'll need can be well encapsulated in the OnMouseDown event.

function OnMouseDown():void
{ 
    var clickedTag:String = gameObject.tag;

    if(clickedTag == "Chopstik") selected = true;
}

Hope that helps.

==

This will print the tag of the last clicked object:

function Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        var hit : RaycastHit;
        if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit))
        {
            Debug.Log(hit.collider.tag);
        }
    }
}

even thought i put the collider on imported model yet it not react with OnMouseOver() function my code is <

function Update () {

if (Input.GetButton ("Fire1") )
{

// isSelected = true;
var clickedTag:String = gameObject.tag;
if(clickedTag == “Melon”)
{
selected = true;

Destroy (gameObject);

Debug.Log("Is selected ");
}

}

}

Somebody please help me