Is it possible to handle HUD + float Variables + press button events in one one blueprint?

Hello guys, I could use some help with the following.

I would like to do the following:
Press a button (for example “F”) => modify a variable (for example add 1 to an existing float of 100) => show the new value on the HUD.
I tried to achieve this, and all of these work separately, but not together in one Blueprint. I was able to use Print String and made a working HUD which shows the original Set value, but the button event didn’t work.

I watched all the official Unreal tutorial videos and some more but the solution eludes me.

Is it possible to do it in one Blueprint (I guess preferably in the HUD)? Any help is welcome :slight_smile:

This is absolutely possible. The attached image shows a blueprint that I made that performs your example. There are three important parts to make this work.

  1. Input events must be enabled for your HUD.
  2. Setup an event handler to increment your value when the desired key is pressed. (Make sure that no other asset is consuming the keypress you are looking for)
  3. Display the value on every Draw HUD event. (Note that there seems to be a bug where the DrawText function does not work until you have changed the color from its default value. You can change it back once you have changed it to something else)

I hope this helps

You, good Sir, are brilliant! It is working and it is great! Thanks a lot, I’m going back to make my first game :slight_smile: