how to do something when you click on an object in unity code example
Example 1: gameobject on click unity
private void OnMouseOver() {
Debug.Log("Hovering over GameObject");
}
Example 2: unity onclick object
void Update () {
}
void OnMouseDown(){
// this object was clicked - do something
Destroy (this.gameObject);
}