I’ve got a set of custom UserWidget BPs making up my initial Main Menu and my Pause Menu. When I open my “PauseMenuRoot” UserWidget BP for editing, I fail this ensure:
UUserWidget::DuplicateAndInitializeFromWidgetTree(UWidgetTree* InWidgetTree)
ensure(InWidgetTree)
InWidgetTree is NULL.
Furthermore attempting to compile the “PauseMenuRoot” BP leads to failing this check:
FObjectDuplicationParameters::FObjectDuplicationParameters( UObject* InSourceObject, UObject* InDestOuter )
checkSlow(SourceObject);
SourceObject (which refers to WidgetClass->WidgetTree) is NULL.
“PauseMenuRoot” worked just fine until I added the seemingly unrelated “MainMenuRoot” UserWidget BP. The only thing that connects them is that they both make use of another custom widget, “LoadSlotButton”. Removing the references to “LoadSlotButton” from “MainMenuRoot” allows me to compile “PauseMenuRoot” without crashing the editor. This confuses me.
The last bit of info is that it seems to decide whether it’s going to crash or not when the editor is opened. I can’t just test a change that I’ve made, I need to save everything and restart the editor to know if my change results in a crash or not.
Tldr: “PauseMenuRoot” BP crashes on compile if the following conditions are met
-“PauseMenuRoot” and “MainMenuRoot” both use “LoadSlotButton”
-The editor has been closed and reopened at some point after the above conditions have been met
“MainMenuRoot” does not crash on compile.
Any ideas what might be causing this or leads for how to track this down?
Did you ever get anywhere with this? I’m having the same issue. I tried deleting Intermediate, Binaries, and Saved but it didn’t help. I also tried reverting my widget bp and re-doing my changes and it happened again.
Was dealing with this same issue in 4.25. I can’t tell from the stacktraces above, but for me the issue was caused by one of my Widgets being REINST, which causes it not to have a valid Widget tree. You can check this by going into the stacktrace when the ensure fails and going back until you find the class of the widget that is causing the problem (check the values of the variables, especially around the initialize() function)
REINST happens when widgets are nested, which can cause circular dependencies. The solution seems to be to create an interface in the blueprint to prevent the circular reference.