Dynamically creating UMG Widgets?

Hey guys, so I’ve got to the stage where I want to start working on making my conversation system into a UI, opposed to text in the console.

My aim is to create a text box for each choice in a conversation, much like most bioware games, with a choice wheel.

All I need is to be able to create UMG widgets on the players HUD that will let me create a list of text boxes, often 1 - 3, vertically in the centre of the screen.

I’ve already got a custom UIWidget for the text box and it’s text is bound to a variable on my custom class. I just need to be able to create and remove them in C++.

I have a blueprint of the custom UIWidget but I don’t know how I would go about placing it on the players HUD and making them stack on top of each other?

I have the same problem

Not sure I understand the question, but if it’s just how to create UMG widgets from C++ then in the class you want to create from add:

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TSubclassOf<UYourCPPBaseWidget> WidgetTemplate;

In the editor set WidgetTemplate to your Blueprint Widget which derives from UYourCPPBaseWidget.

Then to create the widgets from C++:

UYourCPPBaseWidget* Widget = CreateWidget<UYourCPPBaseWidget>(GetWorld(), WidgetTemplate);
Widget->AddToViewport();

I don’t know what you mean by stacking though.

The problem I have with what you wrote is that WidgetTemplate is always null. So to fix that I load the blueprint via c++ with this line

myInventoryWidgetType = StaticLoadClass(UInventorySlot::StaticClass(), NULL, TEXT("/Game/FirstPerson/UI/InventorySlotBlueprint.InventorySlotBlueprint_c"));

By stacking I meant that the widgets would go underneath each other, so like a menu of buttons. that’s all.