onmouseclick unity

C#
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;public class ExampleClass : MonoBehaviour
{
    void OnMouseDown()
    {
        // Destroy the gameObject after clicking on it
        Destroy(gameObject);
    }
}

Source

Also in C#: