Basic HUD question

at one point, I had UMG huds understood pretty well. But its been a while now and I’ve forgotten how to do it properly. I tried reading the Hud tutorial on the docs, but its not only old, but terrible.
Is there a non-video tutorial on how to do a HUD? not the UMG design stuff, but creating the widget, adding to viewport, removing, allowing mouse control and restoring game play after? For main menus, inventories and such.

This is how I currently have my debug menu set up on my player pawn:

This SEEMS to mostly work, but I’ll have to click and move the mouse, tap the TAB button a few times to get the HUD up and down.

Should this be on my player pawn? on the controller? whats up with the HUD blueprint?

HUD should be on the controller. Imo as its constant. Your pawn gets destroyed you won’t have the ability to remove it.

For instance if your pawn spawns a health bar and you destroy the pwn the health bar will remain. And if your new respawned pawn tries to remove the widget it’ll get access none

Hi there, regarding your issue with getting control over your HUD and having to press buttons here and there a few times just to focus in on your HUD:

I have the solution in my current project. I’ll be sure to send you a few images tomorrow on how to pull this off but I am about to sleep sorry.

Just as a basic overview from my wobbly memory, you need to set the gamemode to ui only and set the mouse cursor to visible when you create the HUD and then the opposite when you hide the HUD.
I will dive deeper into this at a later stage.

I’ve just checked out your image and realised you’ve got some of that there already.
One question: is there a reason you have conditional branches for each time you press tab to open and close the menu?

Usually it can be a very short and sweet flip flop

Tangentially related:
Is drag and drop feasible with pure HUD?

Can’t use UMG because I’m doing something that UMG really hates. The thing that I was trying to accomplish got me stuck for three months. Then I switched to pure UI and now I’m halfway done after two days. I’m about to reach the part where I’ll need to do drag and drop, though, and I’m kinda scared that it might not be possible without doing something really hacky.

This is in my Character controller:

•The InputAction_Menu_Interact node is a custom input set up in the Project settings. I also believe I [COLOR="#0000FF"]disabled the tab button function]([/COLOR] which caused some issues with the editor focusing on other windows.
How to set up custom input within Project settings:

•The flip flop controls when I’ve pressed Tab (My custom input action).

•The first press of Tab will set the visibility of my referenced widget. It then plays a sound, sets the input made to “Game and UI” with a reference to the widget. It then sets up animations/FX and more importantly the mouse is set to enabled.

•The second press of TAB simply reverses what needs to be reversed. In your case it will be different.

•To correctly reference the widget I’m pulling up with tab, I need to create the widget itself during the “event begin play” node inside the character controller as well like so:
[spoiler] 129e1fc83b65dbef2f3a549b582d06c470ffe15e.png[/spoiler] You can see I am setting up the reference variable (SAO Menu REF), directly off of the create widget output. This reference will be used like I have in the first image. Note, I am adding the widget to the viewport, but I am setting the visibility of the widget to hidden because TAB is what is controlling the visibility thereafter.

This is perfect! Exactly what I was looking for. I’ve redone the HUD in my project, and it works much better now. Thank you so much! Should put that into a new wiki/doc page. :slight_smile:

The only issue (and I seem to remember having this issue before too), is that I can still control my pawn. Clicking the mouse anywhere other than a button controls the pawn, and all the keyboard keys still work. If I set input to UI only, then I cant hit my menu button (using ‘M’ now instead) to get out of the menu. I tried pausing the game but it stops input from the keyboard as well.

On the input node for the command ("InputAction MenuToggle" in my case), if you click on it, it'll bring up a dialogue in the details panel, and I enabled "**execute when paused**"  which allows me to toggle my menu with the same button, while pausing the game.  Eventually I'll figure how to do a time-slowdown effect while going into the menu.

That’s fantastic I’m glad I could help!

I’d be interested in your findings for time slowing when pausing! I assume you’d have to delay the pause first and have the time slow before the pause kicks in because as soon as the game is paused I find a lot of things stop working.
Sounds fun!