Actually, this did the trick better. My previous answer could still crash the engine.
UInteractionSystem::UInteractionSystem()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
bWantsBeginPlay = true;
PrimaryComponentTick.bCanEverTick = false;
setInteractText();
// Set delegates for range
interactSphere->OnComponentBeginOverlap.AddDynamic(this, &UInteractionSystem::playerEnterRange);
interactSphere->OnComponentEndOverlap.AddDynamic(this, &UInteractionSystem::playerExitRange);
if (GetOwner()){
// Depending on if a Root Component exist, assign or attach the component to Root Component
if (!GetOwner()->GetRootComponent()){
GetOwner()->SetRootComponent(this);
} else {
this->AttachParent = GetOwner()->GetRootComponent();
}
interactText->AttachTo(this);
}