Receiving input from cxrSendInputEvent with Unity new input system

Hello,

On the client side, I am using the Android “Hello Cloud XR” sample that shipped with the SDK, with some minor modifications. It sends touchscreen inputs to the CloudXR server with cxrSendInputEvent():

// Send a touch event along to the server/host application
void HandleTouch(float x, float y) {
if (!IsRunning()) return;

cxrInputEvent input;
input.type = cxrInputEventType_Touch;
input.event.touchEvent.type = cxrTouchEventType_FINGERUP;
input.event.touchEvent.x = x;
input.event.touchEvent.y = y;
cxrSendInputEvent(cloudxr_receiver_, &input);

}

Server-side, I have a Unity 2020.3.0f1 project that uses Unity’s “new input system”. How can I listen for touchscreen events and act accordingly? If I try to inspect Touchscreen.current, it is null. If I add a listener to InputSystem.onEvent, I only get HeadTrackingOpenXR events.

Is there a better way to do this? Or do I need to roll my own system using custom events and memory-mapped files?

Thanks,
David

If anyone else has this problem, I did actually get it working by sending a generic event with some custom userdata. I made a struct with a timestamp and touch coordinates, then sent that using cxrSendInputEvent(). On the server side, I check the memory-mapped file every frame (not sure about the performance implications of that yet…), if the timestamp has updated, I pull out the coordinates of the new touch and write that into an Input event, then queue it (as a mouse click).