Basic UI not showing up?

Hi,

I’ve setup the most basic UI ever and its not showing up. I’ve created an ability bar (hotbar) to show up at the bottom of my screen in a widget blueprint, and that’s it.

Then ive created a HUD blueprint, this basic.

/
And it doesn’t work. What am I doing wrong? Any help greatly appreciated, thanks.

Is the HUD class part of the Game Mode you’re using?

You shouldn’t be creating the widget and adding it to the viewport in your HUD blueprint, instead do this somewhere else like in the player blueprint or the level blueprint. Once you call Add to Viewport your widget becomes a child component of your HUD, you can almost forget about HUD blueprints and just add the widget to viewport in what you consider the most sensible place.

I will completely and utterly disagree with this. HUD is a great place to keep the widgets in, one centralised hub accessible from anywhere in the game - it’s a framework class with additional unique functionality (Event Draw to name one).

Level Blueprint is by far the worst possible choice here as you cannot access anything that’s referenced there…

I would agree that usually level blueprint is an awful place to do this, depending on whether or not you will be referencing it, the player blueprint normally works perfectly well because you can easily make a variable when you first create the widget for referencing in other blueprints and it is fare easier (imo) to add and remove widgets in the blueprint of the character / actor that uses the widget for sake of what makes sense for when you reference it later if you do. If you are just trying to get your widget to show when the level starts and you won’t be altering it or referencing it the level blueprint will suffice to actually allow you to see it on the screen if you want to test it

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/30025-what-is-the-appropiate-relationship-between-hud-and-widgets

You might find this thread useful

Ah yeah, I wasnt aware of that, good to know cheers.

Epic once had plans on beefing up the hud class and make it a dedicated host for widgets, actually. Wonder what happened to that idea.

It’s still super useful when you want to draw a bunch of lines to connect widgets or lines that connect widgets with world objects. Or when your project is UI heavy and you need stuff organised and communicate efficiently with next to no casting. Also dispatcher automation, since you have all references in one place - bind events and forget about null references.

Ah ok thank you.

I think so yeah.

I managed to get it working by doing everything in my character blueprint instead, thanks guys.

I managed to get it working by doing
everything in my character blueprint
instead, thanks guys.

So you tried to use the HUD without ever assigning it to the GameMode?

No I told you I did assign it to the HUD class, what do you mean?

When you extend a custom HUD, you need to tell your custom game to use it, note the HUD:

254147-capture.png

The same goes for other framework classes.


But no worries, you got it working and that’s what matters, keeping in the Pawn is absolutely fine.