Touch - drag different objects

Hi, I’m trying to make draggable objects on the Stage for Android and iOS, looking in the forum I found this script but it doesn’t work, have any suggestions?

The most problematic thing is to isolated the touch event on a specific game object.

This script is attacched to every draggable object on the stage:

#if UNITY_ANDROID
	
	void Update () {

		foreach (Touch touch in Input.touches){

			Ray ray = Camera.main.ScreenPointToRay(touch.position);
			RaycastHit hit = new RaycastHit();
		
			if (Physics.Raycast(ray, out hit, 100f)) {
				
				//Debug.Log (hit.collider.transform.position);
				
				if(touch.phase == TouchPhase.Began){
					var cameraTransform = Camera.main.transform.InverseTransformPoint(0, 0, 0);
					transform.position = Camera.main.ScreenToWorldPoint(new Vector3 (touch.position.x, touch.position.y, cameraTransform.z - 0.5f));
					//objectSelected();
				}
				
				if(touch.phase == TouchPhase.Moved){
					if (hit.collider.gameObject == this.gameObject) {
						var cameraTransform = Camera.main.transform.InverseTransformPoint(0, 0, 0);
						transform.position = Camera.main.ScreenToWorldPoint(new Vector3 (touch.position.x, touch.position.y, cameraTransform.z - 0.5f));
						//objectDragged();
					}
				}
				
				if(touch.phase == TouchPhase.Ended){
					//objectDeselected();
				}

			}
		}

	 }
#endif

You are going in the right direction but need some changes. Checkout the tutorial i have made for touch and drag objects. Here is the link - Newtonians' Blog 3D: A Simple and Efficient Touch And Drag RigidBodies For Unity 3D (Beginner Friendly) - Part 1
I hope this tutorial may help you.