Can a UMG Button simulate a Keyboard Key?

Hello, I want to simulate a keystroke with a UMG button. I have an Android project and there is no keyboard available. Is this possible?

And what do you expect to achieve by this? You want to create your own virtual keyboard within the project?

No, not that, I would like to perform an action with the umg button that I do on the PC by pressing a key.

So what you really want to do is trigger an input event from a UMG widget?

First: The easiest way to do this is probably to just add a second event on your player controller that triggers the same code as the PC-based input event. Then bind that event to an event dispatcher in your GUI widget. When the widget invokes the dispatcher, the event is triggered, and the code runs. Very straightforward.

If that’s not good enough: Actions in the Input setup can be bound to multiple separate input events, to support mouse, keyboard, controller, VR grabbers, all at the same time, so you could define another action for “triggered from input,” rather than emulating a specific key. This will also work better when the user re-maps key bindings, uses different language keyboards, etc.

Check out APlayerController::InputKey:

You could also implement a custom UInputComponent in your UI and push it onto the player controller.

Or, maybe the system that already works for mobile, can work for you. Check out the “virtual joystick” support, which I think starts at UDisplayClusterPlayerInput (but this is a guess, haven’t used it myself.)

1 Like

Thanks for your reply, i found my solution. I trigger an second custom event and set a secont trace to set my inspecting objekt as target.
I hope this makes sense to you, it works for me.