How to add Keystroke detection in Unreal Engine 4

Hello There. I’ve been trying to add a keystrokes feature to my game, which looks something like this.
image
Basically, It is a widget on the screen which has an image and text, each button on the keyboard has one, and when it is pressed, that button will change colour for the time it is pressed. I am trying to replicate it here. This is the blueprint I try to use. However, This completely breaks the in-built movement provided with starter content in ue4 projects.
image

If someone has a fix, please do tell me. Thank you!

Not sure what built-in movement is in the case? The default flying pawn?


  • use the existing movement input to set the brush rather than a separate keypress
  • or select that W node and untick Consume Input
  • or implement keypresses in the widget and pass Unhandled; but then you’d need to route input through the widget

Option 1 seems the most straightforward but if you’re using the default flying Pawn, its movement is implemented on the C++ level. So either make your own Pawn + movement or use #2.

1 Like

Unticking Consume Input did the trick! Thank you very much Everynone.

(Sorry for not specifying which type of movement, It’s the walking
movement provided with the First person template. I had tried doing the thing from the inputaxis moveforward event using a sequence, that did not work.)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.