I followed this tutorial and defined a UIventory
class. This inventory has some default components such as text and buttons that I would like to change in code later.
If UIventory
were an actor class, I would have created a member variable like UTextRenderComponent* Title;
and in the constructor, wrote Title = CreateDefaultSubobject(TEXT("Title"));
. I’m attempting to do the same right now by storing a UTextBlock*
variable and using CreateDefaultSubobject
on it, but when I create a new widget blueprint in the editor and use UInventory
as the parent class, no text component shows up.
How do I properly create UMG components in code? Or can I not pre-define components–and if so, how can I work them them?