unity click event on gameobject code example
Example 1: unity click object
void OnMouseDown()
{
// this object was clicked - do something
Destroy (this.gameObject);
}
Example 2: how to click a gameobject in unity
using UnityEngine.UI;
public Text text;
text.text = "new text";