Hy, I’m doing the UI menus for an Aracade Game and I got a simple problem:
I can click and interact with all my widgets buttons without problem, but I can’t interact with them with a simple press Key event like in the screen below.
I enable “IsFocusable” and try to force the “Set Keyboard Focus” on self but it changes nothing. Is there possibly something I forgot to set up in the HUD ? Or in the widget directly ? Is a GameMode needed ?
You need to know that keyboard key triggers depend on player controller possession, not the character/actor class. You will have to implement keyboard functions inside a possessed (by the controller) actor class. You could also use delegate functions if you want to encapsulate the keyboard execution inside the widget class; that way, you can have a more proper structure.
However, depending on how advanced the controls are supposed to be, it might be a better idea to set them up in the controller and propagate to blueprints that are supposed to process it.
As what @Everynone said, using the overriding function(s) method is just a temporary solution. I would still recommend that you use a better approach by implementing delegates (as I proposed) or in Blueprint; it’s called an Event Dispatcher.