New Input System - UI Input with VRPN: how to?

Hello,

I have a controller that sends its data (position, buttons clicked etc.) to my Unity game via VRPN. Indeed, the controller collects the data on a computer different than the computer on which the game runs.
I use UVRPN for this, which gets the raw data, and fire some events accordingly. E.g. I subscribe to OnButtonDown(int x) to know when the button x was pressed/held/etc. And then my scripts do what they have to, let’s say for instance change the material of the object currently targeted. Ok, that works.

Now, my problem is the menus. When I hover a UI button and click with my controller, the OnClick() event of the button is of course not triggered, like it would automatically be the case if I was using my mouse directly.
My question is: how do I do this the right way? How do I somehow re-wire my vrpn data to Unity’s Input system?

I was initially using the legacy input system, but I recently found that maybe going with the new Input System was the right path (plus migrating to the new input system can’t be bad anyways). I thought of this because I saw the example for “creating a custom device” here.
Is it the right way of doing it? Will this achieve what I want?

Hopefully I managed to be clear enough :smile:

Thanks a lot for any confirmation or lead!
Arnaud

I also have been researching this same exact problem. I would love to hear about any updates you have found.

Hello @rikerIn3rsion ,

I looked a bit and managed to do it, I think.
What I did is basically simply take the “Custom Device” sample from the Input System package, and rewrite it to link it with UVRPN.
Here’s the modified sample that worked for me.

The key was also to set the action type as “Pass Through” in the Input Action Asset window

By doing that I was able to click a button via my VRPN input!

Hope this helps!
Arnaud

1 Like