I got this working in UE5.4. If it helps anyone else, I made a plugin using the āEditor toolbar buttonā template (NOT the standalone window one), then changed the ā.Build.csā fileās private dependencies to this:
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Projects",
"InputCore",
"EditorFramework",
"UnrealEd",
"ToolMenus",
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"Blutility",
"UMGEditor",
"UMG",
"EditorScriptingUtilities",
// ... add private dependencies that you statically link with here ...
}
);
And then for the actual code in the ā.cppā file I did the following - but you need to:
(1) replace āMyPluginNameā with yours, and
(2) the statement after TEXT should be your reference.
So, in content browser, find your Editor Utility Widget, right-click and choose REFERENCE. Then paste that in, replacing the one I have in there. (I had my widget inside āCONTENT>Letsgoā and the widget itself was called āLetsgoā.)
void FMyPluginNameModule::PluginButtonClicked()
{
UObject* Blueprint = UEditorAssetLibrary::LoadAsset(FString(TEXT("/Script/Blutility.EditorUtilityWidgetBlueprint'/Game/Letsgo/Letsgo.Letsgo'")));
if (IsValid(Blueprint)) {
UEditorUtilityWidgetBlueprint* EditorWidget = Cast<UEditorUtilityWidgetBlueprint>(Blueprint);
if (IsValid(EditorWidget)) {
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>();
EditorUtilitySubsystem->SpawnAndRegisterTab(EditorWidget);
}
}
}
However the most IMPORTANT part is the top of the ā.cppā file, otherwise none of it will work:
// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimPalV2.h"
#include "AnimPalV2Style.h"
#include "AnimPalV2Commands.h"
#include "Misc/MessageDialog.h"
#include "ToolMenus.h"
#include "EditorUtilityWidgetBlueprint.h"
#include "EditorUtilitySubsystem.h"
#include "Editor/Blutility/Classes/EditorUtilityWidget.h"
#include "./../Plugins/Editor/EditorScriptingUtilities/Source/EditorScriptingUtilities/Public/EditorAssetLibrary.h"