Hi, when I am creating a new plugin with the toolbar button template and trying to just link UEditorUtilityWidgetBlueprint I do get the following error on the Cast line:
unresolved external symbol "private: static class UClass * __cdecl UEditorUtilityWidgetBlueprint::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UEditorUtilityWidgetBlueprint@@CAPEAVUClass@@XZ) referenced in function "public: void __cdecl FChromaButtonsModule::OpenWidget(void)" (?OpenWidget@FChromaButtonsModule@@QEAAXXZ)
Build.cs:
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Projects",
"InputCore",
"UnrealEd",
"ToolMenus",
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"UMG",
"UMGEditor",
"Blutility",
// ... add private dependencies that you statically link with here ...
}
);
Code (In Plugins main class):
void FChromaButtonsModule::PluginButtonClicked()
{
UE_LOG(LogTemp, Warning, TEXT("OpenWidget"));
FString assetPath = TEXT("EditorUtilityWidgetBlueprint'/Game/TestWidgetFolder/MyTestWidgetBlueprint.MyTestWidgetBlueprint'");
FSoftObjectPath tmpPath = FSoftObjectPath(assetPath);
auto loadedAsset = tmpPath.TryLoad();
if (UWidgetBlueprint* Blueprint = Cast<UWidgetBlueprint>(loadedAsset))
{
if (Blueprint->GeneratedClass->IsChildOf(UEditorUtilityWidget::StaticClass()))
{
//the following line gives me a headache
UEditorUtilityWidgetBlueprint* EditorWidget = Cast<UEditorUtilityWidgetBlueprint>(Blueprint);
/*... do things here ... */
}
}
}
/*
This is the same code snippet as used in the engines code:
https://github.com/EpicGames/UnrealEngine/blob/d94b38ae3446da52224bedd2568c078f828b4039/Engine/Source/Editor/Blutility/Private/AssetTypeActions_EditorUtilityWidgetBlueprint.cpp#L121
What am I missing here
Thanks in advance