EventSystem - Broadcast my own Input

Hello,

I have a bunch of coordinates being fed into Unity from an external source. These coordinates are in Vector2, with respect to Unity’s Canvas.

I would like to insert these coordinates into Unity’s EventSystem as an input ‘IPointerEnterHandler’. However there could be multiple inputs in one frame, thus it needs to support Multitouch.

Does anyone have an idea how I can approach this? Thanks.

If you know the object you’re executing the pointerEnter event upon, then you can simply call the following when you want your inputs injected:

ExecuteEvents.Execute(target, eventData, ExecuteEvents.pointerEnterHandler);

Where:

target = gameObject to execute the event on

and eventData = an instance of PointerEventData that has its relevant fields populated with your data

If you don’t know the object you’re executing the pointerEnter event upon, then you will have to do some raycasting (or query a raycaster) to find out where your inputs go.

Hope that helps!