How to get which key was pressed in blueprint

Hi all, how I can get which key was pressed using blueprint?

I known that you can use override function in widgets OnKeyDown and compare if it equal to specific key, but how I can get exactly which input key was pressed and displayed in Print string ?

Thank you guys!

I am not sure what you are asking but here is an answer hope it helps:
Inside of the player blueprint, and make a new blueprint (An input key), make it the key you want to be the key that the string notices. And attach the input blueprint to a print string and type in a message with whatever you want in it.

Hope this helps!
Happy game development!

Thanks for answer and merry Christmas!

I was asking to get key i pressed to text. If i pressed space bar i need to get it in text (key name), i need know which key has been pressed by player.

Thank you


I found the solution, I just missed one node, may be was just tiered :slight_smile:

Thank you for you help!


Well, if that’s the case than I think you can still set up inputs for every key and then have them have different text strings for example:
You could set up the inputs for all your keys, and then set up print lines or print text to the input and make the text say something like (Key name) was pressed. It would take a while but it is the way that is the simplest. You could always attach an event or cast to a widget but that is a lot more time consuming and harder.
Hope that helps.

am I late? xD

1 Like

why not this?

your BP looks so complicated and I don’t get the point


I was in the process of doing an input buffer system in BP since I didn’t really see too much on it and ran across this post and used THIS post for a starting point actually.

Last edit I did on it:
And an

don’t mind the top right, I was just lazy and didn’t take it out and it reminded me of an old animation joke I saw about Australia.

sorry for the edits, i don’t really post here much haha

In the future, please only use code that is relevant to the question. It can really confuse beginners who think they might need all of this to preform the very simple task.

1 Like