I am able to set up a UWidgetComponent
with a user widget (via SetWidget()
) no problem, but when I use SetSlateWidget()
instead, I get EXC_BAD_ACCESS
in UWidgetComponent::TickComponent()
. Am I missing something?
UWidgetComponent* StatViewComponent = NewObject<UWidgetComponent>(GetOwner(), UWidgetComponent::StaticClass());
StatViewComponent->RegisterComponent();
StatViewComponent->AttachToComponent(GetOwner()->GetRootComponent(), FAttachmentTransformRules(EAttachmentRule::KeepRelative, EAttachmentRule::KeepRelative, EAttachmentRule::KeepRelative, false));
SAssignNew(StatView, STextBlock).Text(FText::FromString(GetName()));
StatViewComponent->SetSlateWidget(StatView);
StatViewComponent->SetWidgetSpace(EWidgetSpace::Screen);