I want to make a simple drag and drop system in 2D in Unity.

When the user drags the object to a position, I want to check if the position is valid. As in I want the user to drag an object onto another object with a specific tag of my choice. If it's anything other than that, the dragged object should return to its original position.

My problem is that my current code for detecting the object I've dropped onto always detects the object I dragged instead. How can I modify this code to detect the object under it?

```
// The plane the object is currently being dragged on
Plane dragPlane;

// The difference between where the mouse is on the drag plane and 
// where the origin of the object is on the drag plane
Vector3 offset;

Camera myMainCamera;

Vector3 originalPos;

void Start()
{
    myMainCamera = Camera.main;
    Physics2D.queriesStartInColliders = false;
    originalPos = gameObject.transform.position;
}

void OnMouseDown()
{
    collideCheck = false;
    dragPlane = new Plane(myMainCamera.transform.forward, transform.position);
    Ray camRay = myMainCamera.ScreenPointToRay(Input.mousePosition);

    float planeDist;
    dragPlane.Raycast(camRay, out planeDist);
    offset = transform.position - camRay.GetPoint(planeDist);
}

void OnMouseDrag()
{
    Ray camRay = myMainCamera.ScreenPointToRay(Input.mousePosition);

    float planeDist;
    dragPlane.Raycast(camRay, out planeDist);
    transform.position = camRay.GetPoint(planeDist) + offset;
}

private void OnMouseUp()
{
    //check if there is something at that position
    Collider2D hitColliders = 
    Physics2D.OverlapCircle(transform.position, range); 

    Debug.log(hitColliders);
    if (hitColliders.gameObject.tag == "p1") 
    { transform.parent = hitColliders.gameObject.transform; }
    else 
    { transform.position = originalPos; } 
}

private void OnDrawGizmosSelected()
{
    Gizmos.color = Color.red;
    //Use the same vars you use to draw your Overlap SPhere to draw your Wire Sphere.
    Gizmos.DrawWireSphere(transform.position, 1);
}

```