Best way to activate keyboard input keys with UMG buttons

I’m trying to connect UMG widget button with Keyboard input keys. Right now I have U key that loads my game but these is Android project so in my main menu widget I have Load button. So I just need to trigger U key some how with widget button. I tried dispatcher but it doesn’t activate U key on Touch or mouse click. Maybe I missed something in the process. Wouldn’t that work though? Thank’s guys!! It’s driving me nuts…

1 Like

Create a CustomEvent in the widget, override onKeyDown and trigger that custom event. Hook up the same node network to the both the button and the custom event.

1 Like

Thanks for the answer but don’t seem to understand anything after I make Custom Event in the widget. I don’t understand what to do after that. I cant find onKeyDown. and how to trigger and hook it up after. Would you able to make a screen shot of that. I know I’m being pain in the S. Sorry!!!

1 Like

No worries.

If I understood you right, you want a keypress have the same effect as an UMG button, right?

In your widget:

Create a CustomEvent that takes a string and have a button fire the same node, then override the onKeyDown, like so:

In the onKeyDown:

Also, make sure that the root element of the widget has the isFocusable flag ticked. For the keyboard to work properly with widgets, you might need to override onMouseEnter and set Keyboard Focus to a specific widget element.

1 Like

Thank you for the answer and all the work!!!. How ever what I really need it was actually reverse to have UMG button do the same thing as the Keyboard input key. Right now (Page Up) button saves my game but what I would like is to have UMG widget button to save my game instead since it is a mobile project. Sorry I didn’t explain properly. No rush. THANK YOU!!!

what I would like is to have UMG
widget button to save my game instead
since it is a mobile project

Where do you currently have the Page Up save the game, in the controller? In the player character?

Here is my set up. One in set up in my UMG widget on button press and the other in My Game Mode.

Actually I purchased Easy Save and Load from Unreal Market. To simplify everything. How ever the plug in saves a file in to save game folder but wont load it up. I try it on two computers and his test maps don’t save translation they just print string that it’s been saved. He says the plug in is working he test it out. So why wouldn’t it work on my PC. In save game folder there is a MapName file. So load from slot (MapName) should load up am I right??

I’m unfamiliar with that plugin, unfortunately.

Ya I see. Thank you. Anyways.