Getting null when trying to create a widget

    Hi everyone, been working with unreal for a while but this is the first time I've had to take to the forums.

     I'm getting a very peculiar problem trying to create a widget. I've had this block of code working for months and I haven't touched it, but recently it just stopped working. I was looking into it and for some reason the UserWidgetClass just becomes nonsense when trying to CreateWidgetInstance in the CreateWidget function and I have no idea why.


[header]

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "UMG")
      TSubclassOf<UUserWidget> NodeSelectWidgetClass;

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    UWidgetComponent* NodeMenuComponent = nullptr;

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    UUserWidget* nodeSelectWidget = nullptr;

[CPP]

void AMission_PlayerController::CreateNodeSelectTree(FVector nodeLocation)
{

    nodeSelectWidget = CreateWidget<UUserWidget>(this, NodeSelectWidgetClass);
    NodeMenuComponent->SetWorldLocation(nodeLocation);
    NodeMenuComponent->SetWidget(nodeSelectWidget);
}



I have the proper blueprint set up in the NodeSelectWidgetClass, I just can’t for the life of me figure out where the problem is. Any help would be greatly appreciated, thanks.

It is not easy to answer without whole codes since there is no clue right now. :frowning: I recommend you to debug engine codes with breakpoints or printing logs.

@Gnanaht If I had to guess, he probably just forgot to call AddToViewport. This is a year old post btw.