how to get name of game object with position by raycast

i used OnMouseDown() but it’s so simple and not useful :

void OnMouseDown()
{
 Debug.Log("The " + this.GameObject.name + " was clicked");
}

Just gameObject with a lowercase:

void OnMouseDown()
{
    Debug.Log("The " + gameObject.name + " was clicked");
}

Note that OnMouseDown already uses a raycast internally, so you don’t need an extra raycast.

(I also commented your other question in regards to using the name of the object that you were chaching there.)