4.19.2 - Ensure condition failed: Menu != nullptr



Hey guys in 4.19.2 everything compiles fine but I am now getting a nullptr when calling

UMenuWidget* Menu = CreateWidget<UMenuWidget>(this, InGameMenuClass);

This is sort of frustrating as I have no clue as to what could be causing this right now… Maybe I am just blind but been trying to figure it out the past 2 hours but no luck. Everything is setup the way it should be. The BP is there. I am going to clone the repo now and try with that as well…

The MainMenu is still fine btw, just the in game one that does not want to work…

EDIT:: So after importing a fresh copy of the project from git with the current lecture tree checkout things seem to behave again… I have literally no idea what happened as the code is literally the same…


I had the same issue and for me it turned out to be the path in this line:

ConstructorHelpers::FClassFinder<UUserWidget> InGameMenuBPClass(TEXT("/Game/MenuSystem/WBP_InGameMenu"));

Specifically, the path passed in to the constructor has to match the path to your InGameMenu widget blueprint, in this case /Game/MenuSystem/WBP_InGameMenu. If the path is wrong, I believe the object still gets created but the .Class member will be invalid, hence why you get nullptr when trying to create the widget.