Class "FBlueprintEditor" has several inline getter methods as part of its public API (e.g. GetPreviewActor() and GetPreviewScene()). However, even though they are public, those methods are inaccessible to other C++ modules because the class is tagged with "KISMET_API", which makes the compiler attempt to import the methods with "DLLIMPORT" instead of expanding them inline. Any attempts to use such methods result in linker errors.
If those methods are indeed intended to be public, this can be fixed by adding "FORCEINLINE" to them. This will make client modules use the inline expansion of the methods and avoid linker errors.
Add the following function to any C++ Editor Module:
void MyTestFunction()
{
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
AssetEditorSubsystem->OnAssetOpenedInEditor().AddLambda([](UObject* EditedAsset, IAssetEditorInstance* AssetEditor)
{
UBlueprint* EditedBlueprint = Cast<UBlueprint>(EditedAsset);
if (EditedBlueprint)
});
}
When building, the code will compile successfully, but the linker will complain:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: class AActor * __cdecl FBlueprintEditor::GetPreviewActor(void)const"
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-219071 in the post.
0 |
Component | UE - Gameplay - Blueprint Editor |
---|---|
Affects Versions | 5.4 |
Target Fix | 5.6 |
Created | Jun 28, 2024 |
---|---|
Updated | Sep 30, 2024 |