How to start Hud animation on button press

Hello,

I am trying to make a minigolf game currently (starting using the rolling demo) and having some issues with HUD. I have been reading through HUD via the HUD and UMG hud and cannot get what they show to work.

I am trying to make a power bar that uses progress bar. It is supposed to on space bar press start filling up to 100 then take that value (do some multiplication to make it a larger) and apply it as an impulse to the x vector.

My first issue is using the guides I could not get the UMG hud to display (image of blueprint attached HUD variable cannot connect to target because physicsballbp is not compatible).

As a newb trying to help out:

First off, I think you can get rid of the casting node. I am not sure why it is there.
Plug the return value from your widget into the target on “add to viewport” and it should display at least something.
You can check if your widget is displayed at all by adding some dummy-text to your widget for example.

If the dummytext is displayed but not your power-bar the problem is probably inside the widget.

Seems this is coming really late. I am currently making and endless runner which uses this exact mechanic. What i did was

  1. promote the HUD WIDGET to a variable in my game instance or game mode(preferably game instance). This prevents “hud already exists” errors even if you reopen level.
  2. Add an onclick/pressed event and make my game mode/insatnce reference the hud widget. this way all classes can now call the hud widget and its function or animations
  3. The progress bar can be bound to a float in your game mode and to make it reduce just modify the float value as needed. I made my reduce continuously when used. I did this using an animation withing the HUD (animated the percent bar)

I’ll leave screenshots incase what i typed wasnt clear. For more info or help text me on

It’s been almost 6 years, afraid they’ve moved on after completing their MMOs :wink:

One note here - bound functions execute every frame and casting is a relatively expensive operation. Use this method with care.

It’s ok to have it here and there but relaying on it will add up very quickly. If you ever notice dropping frames, the first culprit to look at will be casting 60 times every second in 5 different widgets for the entire game.


If a widget relies on the Game Mode for its data, perhaps the widget could be created / referenced there and have the data piped in via a direct reference.

Generally speaking, you will want actors to push data into widgets (with an event driven approach where applicable) rather than have them pull data out of objects. Although it depends on the circumstances, of course.

Good luck with the rest!

Yeah it was replace with a hud animation when called rathar than the initial event tick. At the time I was testing for a bug so attached a print string to know when it’ll pop up.