Created
May 9, 2021 07:53
-
-
Save FilipSivak/c03f724a34da59a9463eba7248868047 to your computer and use it in GitHub Desktop.
Unreal - open editor utility widget by C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "EditorUtilityWidgetBlueprint.h" | |
#include "EditorUtilitySubsystem.h" | |
UObject * Blueprint = UEditorAssetLibrary::LoadAsset(FString(TEXT("EditorUtilityWidgetBlueprint'/Game/EditorUtilities/MyWidget.MyWidget'"))); | |
if(IsValid(Blueprint)) { | |
UEditorUtilityWidgetBlueprint* EditorWidget = Cast<UEditorUtilityWidgetBlueprint>(Blueprint); | |
if (IsValid(EditorWidget)) { | |
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>(); | |
EditorUtilitySubsystem->SpawnAndRegisterTab(EditorWidget); | |
} | |
} |
void FExamplepModule::PluginButtonClicked()
{
// Put your "OnButtonClicked" stuff here
FText DialogText = FText::Format(
LOCTEXT("PluginButtonDialogText", "Add code to {0} in {1} to override this button's actions"),
FText::FromString(TEXT("FExamplepModule::PluginButtonClicked()")),
FText::FromString(TEXT("ExamplepModule.cpp"))
);
FMessageDialog::Open(EAppMsgType::Ok, DialogText);
}
hello,
Hello, I'm a beginner to this can you help me to fix this issue?
Do you accept paid work?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry for that... can you help me to fix this?? "how to use a plugin editor toolbar button to run a editor utility widget, please help.."