Description

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.

Steps to Reproduce

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)

{ FBlueprintEditor* BlueprintEditor = StaticCast<FBlueprintEditor*>(AssetEditor); BlueprintEditor->GetPreviewActor(); }

});
}

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"

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-219071 in the post.

0
Login to Vote

Unresolved
ComponentUE - Gameplay - Blueprint Editor
Affects Versions5.4
Target Fix5.5
CreatedJun 28, 2024
UpdatedJul 15, 2024
View Jira Issue