Simulated button clicks

I realise this has been asked several times before, but I can’t find an answer that isn’t along the lines of either ‘write your own input function’ or ‘trigger windows events etc’. Whilst both of those are good solutions, they don’t solve my exact problem as detailed below.

So I am writing a VR application (for Vive), and within said VR application I have a virtual keyboard, operated by physically ‘clicking’ on buttons with a controller. You could picture this as being like the touch screen keyboards you find on tablets/phones, though in 3D.

I would like the keyboard button clicks to be correctly piped through the event system so they work correctly with input fields and similar text based ui controls.

The most robust and logical way I can see of doing this would be for me to be able to generate simulated keyboard events and push them into the event queue, however it seems to be locked off.

Any thoughts?

Unfortunately Unity doesn’t provide a way to queue events into it’s internal event queue. Since the new UI has been introduced they added the PopEvent method which is used by the new UI system to actually get all those keyboard events. Though the opposize doesn’t exist. So we can’t manually queue events. (At least i haven’t found any built-in way).

For example the new InputField component of the new UI system directly obtains the events from the queue. So since we can’t queue events manually, there’s no way to provide those events using bulit-in methods.