Hi.
I’m trying to attach a 3D widget to a pawn class.
So, basically I have a C++ class called ItemInfoBox that inherits from UUserWidget. I then created a blueprint off of it and setup a simple 3D widget.
Then, I went to my Item class (C++) and attached the widget like this:
InfoBox = ObjectInitializer.CreateDefaultSubobject<UWidgetComponent>(this, TEXT("InfoBox"));
InfoBox->AttachParent = RootComponent;
InfoBox->SetWidgetSpace(EWidgetSpace::Screen);
InfoBox->SetDrawSize(FVector2D(300, 200));
static ConstructorHelpers::FObjectFinder<UClass> InfoDisplayObject(TEXT("Blueprint'/Game/Ocllo/UI/ItemInfoBox.ItemInfoBox_C'"));
if (InfoDisplayObject.Object)
{
InfoBox->SetWidgetClass((UClass*)InfoDisplayObject.Object);
}
Now, it does seem to work. I can actually see the widget in-game, around the items it’s attached to, but I can’t seem to be able to interact with any of its properties from the Item class.
My C++ parent widget has a property “FFstring SomeText” which I see in the child blueprint as well.
How would I go about setting the widget properties from a class the widget is attached to?
Thanks!