How to Enable Keyboard Input on a Widget?

Hello, I am devoloping games just for fun, just started learning UE5 and wanted to make a minigame only accessable in a widget. Like this:


m

But I wanted to make it so whenever I hit space bar if the blue line is in the red box, it will print that “i win”.

But I check in the debug mode and see that “spacebar” is not even firing. I think me setting up the game mode to “UI only” like this:

is preventing me from using any sort of input including keyboard events.

So my question is, can I make it so, I can send keyboard inputs inside a Widget while blocking them from making my character move?
For example my sending spacebar input while preventing my char from jumping up and down?

Thanks

You can make a function or event inside of the widget, and then you can pass it to either the character or level blueprint where you are able to execute keyboard events.

The widget doesn’t contain any keyboard events, so whatever you do; you will not be able to access them. I think there is a good reason for it, and it can possibly have to do with replication. Let me know if you need a more descriptive explanation.

1 Like

It works!
Although i have no idea why it does, need to read more into functions.
Thanks a bunch

1 Like