Is it Possible to use the Canvas/Graphic Raycaster without Pointer event data

i was able to work around this by passing an old PointerEventData.from a previous function and overwriting the PointerEventData.position with the desired vector3 , i would like to also be able to use this function without the PointerEventData.

public void OnDrop(PointerEventData eventData)
    {
        List<RaycastResult> results = new List<RaycastResult>();
        [B]RC.Raycast(eventData, results);[/B]
        foreach (RaycastResult result in results)
        {
            if (result.gameObject.CompareTag("Items") || result.gameObject == eventData.pointerDrag){ Sort(eventData); return; }
        }
        eventData.pointerDrag.transform.position = Point;
    }
    private void Sort(PointerEventData eventData)
    {
        foreach(Vector3 P in Points)
        {
            List<RaycastResult> results = new List<RaycastResult>();
            eventData.position = P;
            [B]RC.Raycast(eventData, results);[/B]
            int i = results.Count;
            foreach (RaycastResult result in results)
            {          
                if (result.gameObject.CompareTag("Items")) {break; } else { i--; }
                if (i == 0) { Debug.Log("Miss"); eventData.pointerDrag.transform.position = P;return; }
               
            }

        }

    }

@DownER149

Do you mean line 17?

IIRC you can make new PointerEventData and put your position data there. Then do the raycast.

I think it’s mentioned in the docs. Something like this;

var pd = new PointerEventData(EventSystem.current);
pd.position = Input.mousePosition;

Thanks, i almost had it, i didn’t know to use .current, EventSystem was protected and i had no idea how to get at it.