how to make a gameobject do something when clicked unity code example
Example 1: unity onclick object
void Update () {
}
void OnMouseDown(){
// this object was clicked - do something
Destroy (this.gameObject);
}
Example 2: unity click object
void OnMouseDown()
{
// this object was clicked - do something
Destroy (this.gameObject);
}