Widget Component vs. Widget Varriable


I was wondering what is the best way to make a new widget.
Say we are making an RTS game, and we have our building which is an actor. Once clicked, we would want to show a HUD for it. Let’s say we already have the selection functionality.

What is the best way to create that widget for it? make it as a new component in the component area, or once BeginPlay initiate, create a new widget of the desigred class and promote it to a variable?

Keep in mind: the HUD should appear on the screen, and not on the building (thus would be unreachable if the camera is not looking at it).


Widget PB, at begin play, create it and set it as a variable.

Then, on click, add to viewport.

Cast to BP and pull the data needed.

@ Casting the blueprint widget to a blueprint? could you extend your answer please?

Either way, cast from widget to BP or From BP to widget. Depending on where you want you code.

I cast to my widgets in my current game.