during build object moves different position than editor(vr)

hello, so currently I’m creating a simple drag and drop mechanic and I’ve come into an issue wherein editor the game mechanic works perfectly but during building the position of the object during drag shoots off consistently further away. I’ve done some research and people are saying local position vs world position but I have had no luck! if you need more information please let me know happy to provide it!

  private void Awake()
    {
        Physics.IgnoreCollision(GetComponent<Collider>(), ship);
    }

    public void dragStart()
    {
        isDragging = true;
        distance = Vector3.Distance(testcam.transform.position, transform.position);
        previousPos = transform.position;

        Debug.Log(meshDist);
        if (isDragging)
        {
            StartCoroutine(Dragging());
        }
    }

    private void Update()
    {
            Debug.DrawRay(worldOffset, transform.forward, Color.red);

    }

    public void dragEnd()
    {
        isDragging = false;
        transform.position = previousPos;

    }


    IEnumerator Dragging()
    {
        Debug.Log(distance);
        while (isDragging)
        {
            int _layerMask =  LayerMask.GetMask("Path");

            RaycastHit hit;
            worldOffset = transform.position + Vector3.up * offset;

            if (Physics.Raycast(worldOffset, transform.TransformDirection(Vector3.forward), out hit, _layerMask))
            {

                draggedPos = testcam.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, distance));
                transform.position = draggedPos;
                LastKnowPos = transform.position;
                Debug.Log(hit.transform.name);
            }
            else
            {
            }

            yield return null;

        }

    }

Turns out use

new Vector3(testcam.scaledPixelWidth / 2, testcam.scaledPixelHeight / 2

that way it will dynamically get the screen resolution of your phone