[C#] Destroy an object by touch in Android

Hello,I found a lot of example about how to destroy an object in JS, however, i cannot found any reference and example in C#

Anyone can share some reference about it??

Is it using OnCollisionEnter?

Also, i found some coding about drag the object , is it good for me to modify the code for Destroy an object by touch?

Thankyou

void Start () 
    {
    }
     
    // Update is called once per frame
    void Update () 
    {
         
        foreach (Touch touch in Input.touches) 
        {
            Debug.Log("Touching at: " + touch.position);
             
            //Gets the ray at position where the screen is touched
            Ray ray = Camera.main.ScreenPointToRay(touch.position);
             
            if (touch.phase == TouchPhase.Began) 
            {
                Debug.Log("Touch phase began at: " + touch.position);
             
                RaycastHit hit = new RaycastHit();
                if (Physics.Raycast(ray, out hit, maxPickingDistance)) 
                { 
                    pickedObject = hit.transform;                    
                } 
                else
                {
                    pickedObject = null;
                }
            } 
            else if (touch.phase == TouchPhase.Moved) 
            {
                Debug.Log("Touch phase Moved");
             
                if (pickedObject != null) 
                {
                    Vector2 screenDelta = touch.deltaPosition;
                     
                    float halfScreenWidth = 0.5f * Screen.width;
                    float halfScreenHeight = 0.5f * Screen.height;
                     
                    float dx = screenDelta.x / halfScreenWidth;
                    float dy = screenDelta.y / halfScreenHeight;
                     
                    Vector3 objectToCamera = pickedObject.transform.position - Camera.main.transform.position;
                    float distance = objectToCamera.magnitude;
                     
                    float fovRad = Camera.main.fieldOfView * Mathf.Deg2Rad;
                    float motionScale = distance * Mathf.Tan(fovRad/2);
                     
                    Vector3 translationInCameraRef = new Vector3(motionScale * dx, motionScale * dy, 0);
                     
                    Vector3 translationInWorldRef = Camera.main.transform.TransformDirection(translationInCameraRef);
                      
                    pickedObject.position += translationInWorldRef;
                }
            } 
            else if (touch.phase == TouchPhase.Ended) 
            {
                Debug.Log("Touch phase Ended");
             
                pickedObject = null;
            }
        }
    }
}
using UnityEngine;
using System.Collections;

[RequireComponent (typeof(Collider))]//Need a Collider
public class DestroyOnTouch : MonoBehaviour {
	public void OnMouseDown () {//Work with touch
		Destroy(gameObject);
	}
	public void OnDestroy () {
		Debug.Log("Self-destructive: " + name);
	}
}

Thank you, I have modified the code shown in below.

I am using Vuforia and Unity3D.

There are 5 objects under"workstation" hierarchy. it will show these object and delete button in the screen when the workstation marker is captured. If not,no button and objects in the screen

Also, user need to press Yes button after pressing Delete button for confirm to turn on the delete function or No button for tune off the delete function. After that, user allow to touch the object for delete the object

However, all 5 objects have been delete at the same time after pressing the Yes button and the delete button have not been shown again when marker is captured again.

Anyone can help me find the mistake in my code and give me some suggestion in my function?
Thank you

using UnityEngine;
using System.Collections;

[RequireComponent (typeof(Collider))]//Need a Collider
public class ButtonPopup_marker_workstation : MonoBehaviour, ITrackableEventHandler {
     
    private TrackableBehaviour mTrackableBehaviour;
     
        private bool mShow = false;
	private bool mDele = false;
	private bool mShowMenu = false;
	
	private string mDeleText = "Delete";
	private const string mDeleTextOn = "Del/ON";
    private const string mDeleTextOff = "Del/OFF";

	
    void Start () {
        mTrackableBehaviour = GetComponent<TrackableBehaviour>();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
			
			
        }
    }
     
    public void OnTrackableStateChanged(
                                    TrackableBehaviour.Status previousStatus,
                                    TrackableBehaviour.Status newStatus)
    {
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED)
        {
            mShowMenu = true;
			mDele = false;
			mDeleText = mDeleTextOff;
        }
		else
		{
			mShowMenu = false;
			
		}
    }
     

	
    void OnGUI() {

		GUIStyle guiStyle = new GUIStyle(GUI.skin.button);
		guiStyle.fontSize = 18;
		guiStyle.normal.textColor = Color.red;
		
		
		//
        if (mShowMenu&GameObject.Find("Workstation")) {
            if (GameObject.Find("Workstation").transform == null) return;
			
			GUI.color = Color.yellow;
			GUI.Box (new Rect (Screen.width - 140,355,130,250), "DeleteMenu");
         	
	        if (GUI.Button(new Rect(Screen.width -130, 380, 110, 80), mDeleText,guiStyle))
				{
					mShow = true;	
				}
			if(mShow)
				{
					
						GUIStyle guiStyle2 = new GUIStyle(GUI.skin.box);
						guiStyle2.fontSize = 20;
						guiStyle2.normal.textColor = Color.yellow;;
						
					
						GUIStyle guiStyle3 = new GUIStyle(GUI.skin.button);
						guiStyle3.fontSize = 30;
						guiStyle3.normal.textColor = Color.red;
					
						GUI.color = Color.yellow;
						GUI.Box (new Rect (Screen.width/2 - 250 ,Screen.height/2 - 250 ,500,500), "Are You Sure To Turn On The Destory Function?",guiStyle2);
			
					if(GUI.Button(new Rect(Screen.width/2 -200, Screen.height/2 - 75, 150, 150),"Yes",guiStyle3)){
							mDele = true;
		                    mDeleText = mDeleTextOn;
							mShow = false;
		                }
					if(GUI.Button(new Rect(Screen.width/2 +50 ,Screen.height/2 -75, 150, 150),"No",guiStyle3)){
		                    mDele = false;
							mDeleText = mDeleTextOff;
							mShow = false;
                }
				
			}
			if(mDele)
				{
					OnMouseDown();

				}
			
				
			
	 	}
		
	

	}
	
	
			public void OnMouseDown () {//Work with touch
		
		        Destroy(gameObject);
		
		    }
		
		    public void OnDestroy () {
		
		        Debug.Log("Self-destructive: " + name);
		
		    }
	

	
	
	
}

Anyone knows? thank you;)

using UnityEngine;

using System.Collections;

 

[RequireComponent (typeof(Collider))]//Need a Collider

public class DestroyOnTouch : MonoBehaviour {

    public void OnMouseDown () {//Work with touch

        Destroy(gameObject);

    }

    public void OnDestroy () {

        Debug.Log("Self-destructive: " + name);

    }

}

Also, I just using the code as shown above, I cannot touch the object for destroy the object, i think it have not run the OnMouseDown() function.

How can i solve the problem?