using UnityEngine;
using System.Collections;
    
public class ClickScript : MonoBehaviour {
        
void Update ()
{
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if (Input.GetButtonDown ("Fire2"))
{
if (Physics.Raycast(ray, out hit, 100))
{
Debug.Log("hit.tranform = "+hit.transform);
if (hit.collider.CompareTag("a"))
{
//Debug.Log("hit.tranform = "+hit.transform);
//Debug.Log("hit.tranform = "+hit.transform.tag);
}
                    
else
{
//Debug.Log("hit.point = "+hit.point);
}
}
}
            
            
}
        
        
}
using System.Collections;
public class ClickScript : MonoBehaviour {
void Update ()
{
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if (Input.GetButtonDown ("Fire2"))
{
if (Physics.Raycast(ray, out hit, 100))
{
Debug.Log("hit.tranform = "+hit.transform);
if (hit.collider.CompareTag("a"))
{
//Debug.Log("hit.tranform = "+hit.transform);
//Debug.Log("hit.tranform = "+hit.transform.tag);
}
else
{
//Debug.Log("hit.point = "+hit.point);
}
}
}
}
}
Click to find the hit object RaycastHit unity 
4/
5
Oleh 
Unknown
