void Update()
    {
        if (isDragging == true)
        {
            Vector3 mousePos = MouseInWorldCordinates();
            transform.position = new Vector3(mousePos.x - cursorOffset.x, mousePos.y - cursorOffset.y, transform.position.z);
        }

        if (Input.GetMouseButtonDown(0))
        {
            if (da.CanDrag == true)
            {
                isDragging = true;
                zOffset    = -Camera.main.transform.position.z + transform.position.z;
                da.OnStartDrag();

                cursorOffset = -transform.position + MouseInWorldCordinates();
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (isDragging == true)
            {
                isDragging = false;
                da.OnEndDrag();
            }
        }
    }
 private void OnMouseUp()
 {
     if (isDragging)
     {
         isDragging = false;
         da.OnEndDrag();
     }
 }