I’m getting some strange stuff happening.
First, this seems to work:
UBlueprint * Blueprint = Cast<UBlueprint>(FindObject<UObject>(NULL, *FString(TEXT("EditorUtilityWidgetBlueprint'/HyperFoliagePlugin/UI/UI_HFToolkitPanel.UI_HFToolkitPanel'"))));
TSubclassOf<UEditorUtilityWidget> WidgetClass = (TSubclassOf<UEditorUtilityWidget>)Blueprint->GeneratedClass;
UWorld * World = GEditor->GetEditorWorldContext().World();
UEditorUtilityWidget * CreatedUMGWidget = CreateWidget<UEditorUtilityWidget>(World, WidgetClass);
I couldn’t get LoadBlueprintAssetDataFromPath() to find anything in the path, which was odd, so I tried FindObject instead and it worked.
From here the following happened:
- Trying to instantiate the UI in the tab results in “Ensure(InWidgetTree)” failing to pass during CreateWidget.
- Recompiling the blueprint crashes due to a cast failing: CastLogError()
- Reload, duplicate blueprint, delete old blueprint, rename new blueprint to the same. Show tab. It works.
- Reload, back to 1.
I would just assume that it’s not being instantiated or loaded properly, but then the blueprint is corrupted on reload, yet is somehow still OK when duplicated replacing the old one.
What’s going on here?