In UE4, I have created an EditorUtilityWidget in BP.
And I want to use this EditorUtilityWidget from SlateUI.
To do so, I do not want to open the EditorUtilityWidget, but only call the events defined in BP.
SlateUI is created in C++, how can I call specific BP events of the EditorUtilityWidget from C++?
About this, I was able to execute the event by loading the target EditorUtilityWidget with LoadObject, spawning the widget, and then setting the event name in FindFunction.
Here is the code I tried.
UEditorUtilityWidgetBlueprint* WidgetBP = LoadObject<UEditorUtilityWidgetBlueprint>(nullptr, TEXT("/MyPlugin/MyEditorUtilityWidget.MyEditorUtilityWidget"));
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>();
FName tmpId;
UUserWidget* UserWidget = EditorUtilitySubsystem->SpawnAndRegisterTabAndGetID(WidgetBP, tmpId);
UFunction* Func = UserWidget->FindFunction(FName("MyCustomEvent"));
if (Func) {
UserWidget->ProcessEvent(Func, nullptr);
}
else {
UE_LOG(LogTemp, Warning, TEXT("Could not find function."));
}
However, this approach would launch the EditorUtilityWidget as a tab.
Please let me know if there is a way to execute only the events in the EditorUtilityWidget without spawning it as a tab.