Hello Everyone,
I have been working on a game and run into the problem of GetUserWidgetObject() returns null. I use a widget component for interaction that then displays a widget. When I set the widget class it is always null. I have tried setting it with casts but it appears that it doesnt think that the Interactionwidget I use exsists. Below is the function that fails.
if (UInteractionWidget* InteractionWidget = Cast<UInteractionWidget>(GetUserWidgetObject()))
{
InteractionWidget->UpdateInteractionWidget(this);
}
I tried fixing it with
Widget = Cast<UInteractionWidget>(Widget);
Cast<UWidgetComponent>(Widget)->InitWidget();
if (UInteractionWidget* InteractionWidget = Cast<UInteractionWidget>(GetUserWidgetObject()))
{
InteractionWidget->UpdateInteractionWidget(this);
}
But that doesnt seem to work. Here are the files for interaction widget.
InteractionWidget.cpp (393 Bytes)
InteractionWidget.h (695 Bytes)
UE5
Thank you in advance.