Use a key to show the next paragraph in a User Widget while I'm in Input Mode UI Only

Hi!

I want to show a dialog when the player goes into a room. My goal is to don’t let the player moves their character and set a ket to show the next paragraph.

The dialog will be five paragraph. When the player press a key it will show the next paragraph, where there is no more paragraph it will close the dialog box.

To show the text I’m using a Blueprint User Widget. And to don’t let the player moves their character while the dialog is showing, I use the node “Set Input Mode UI Only”.

My problem is that I want to use a key to let the user shows the next paragraph but I don’t know how to do it, because with node “Set Input Mode UI Only” I press a key and nothing happens.

Maybe I can use the node “Set Input Mode Game and UI” and disabling the Input Mapping Context the moves the character and set another Input Mapping Context for the UI.

How can I do it?

Thanks!

You can use enhanced input keys in a widget. Is a bit of a roundabout because the standard input action events only fire in input mode GameAndUI or Game. But if you override On Key Down function inside a widget, you can query the key against an input mapping.

Here, I check if key down is my inventory key in my base hud ui widget and have it toggle inventory sub widget:

Since IA_Inventory is already in my default context, I don’t have to add another context to use it. Though if you’re using keys that might conflict with each other somehow, you may want to add a menu-only context to player controller when you add widget to viewport.