Unreal seems to have the restriction that only a pawn can receive input, and only a player “possessed” pawn on top of that (there must be some exception I haven’t gotten to yet, though, because how would you do menu input with such a system?).
With that in mind, is it possible to visualize player input in an Editor Widget? I can only think of creating a Blueprint interface and then piping the inputs on tick from a pawn to that widget, but that seems extremely ineffective, and I’m not sure how it would compile for release…
(I just want to create a visual of the gamepad inputs for debugging purposes.)
Not really, widgets are happy to handle input. There are some quirks / restriction (like typing in an editable box which consumes all input) but generally speaking, one can achieve what you ask for fairly easily. Also, nearly *any *Actor can receive input, not only pawn. It’s just disabled by default since you either want to handle it in the Controller / Pawn / Widgets. [HR][/HR]
Widgets can override onKeyDown (and up!), mouse, gaming controller input, and touch, too. A widget needs to be focusable and in focus to receive it. Once a widget is in focus, it gets priority when handling input - that’s providing you’re running in at least Game and UI Input Mode (rather than Game Only).
You also get to decide what to do with the (un)handled input - you may choose for the widget to ignore it and pass it over to the player controller instead.
Makes sense, since it’s debug, use whatever floats your boat. Here’s an example of how to pipe in input to the widget from the Player Controller:
This is reasonable only in case you do not absolutely want for the widget to handle input on its own.
What I’d do here, I’d let the widget process the input and pass *Unhandled *in *onKeyDown *so the Player Controller also can process it - I’m assuming you want both, show it and process it in the player controller.
Thank you, I will investigate input modes.
However, I specifically said “action mapped input” in the topic, and I don’t think that means keyup or down but rather, “myactionaxis1” etc. from the project input settings, if I have the nomenclature down correctly (actually, I see now that I should have written “axis mapped input”). Are those accessible outside a pawn?
Because even if I switch off “context aware” in the editor widget blueprint, I can’t find my named inputs, but I do find them inside of my pawn.
No, you can’t access input mapping in the widget. You get a chance to intercept their associated key presses, that’s all.