Hello,
After a customer reported a problem with packaging my plugin using Blueprint Nativization I tracked down a bug. I use a couple of BlueprintNativeEvent UFUNCTIONs, but the generated nativization code contains errors. I picked an example method in one of my classes. This is how it is declared:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "AdvKit")
bool CreateTransitionBetween(TSubclassOf<AAdvKitCharacter> ForCharacterClass, AAdvKitZone* SourceZone, AAdvKitZone* TargetZone);
virtual bool CreateTransitionBetween_Implementation(TSubclassOf<AAdvKitCharacter> ForCharacterClass, AAdvKitZone* SourceZone, AAdvKitZone* TargetZone);
The signature inside the generated blueprint c++ code looks like this however:
virtual void CreateTransitionsFor_Implementation(UClass* bpp__ForCharacterClass__pf, AAdvKitZone* bpp__ForZone__pf) override;
The first argument’s type has been changed from TSubclassOf to UClass* resulting in the compiler throwing this error:
UATHelper: Packaging (Windows
(64-bit)): UnrealBuildTool:
C:\Project\Intermediate\WindowsNoEditor\NativizedAssets\Source\NativizedAssets\Public/BP_LadderStepBuilder__pf964772836.h(20): error C3668:
‘UBP_LadderStepBuilder_C__pf964772836::CreateTransitionsFor_Implementation’:
method with override specifier
‘override’ did not override any base
class methods
This happens for every method using TSubclassOf as an argument. I hotfixed it by introducing a virtual method in the base class that matches the signature and calls the correct method:
bool UAdvKitTransitionBuilderModule::CreateTransitionBetween_Implementation(UClass* ForCharacterClass, AAdvKitZone* SourceZone, AAdvKitZone* TargetZone)
{
if (!ForCharacterClass->IsChildOf(AAdvKitCharacter::StaticClass()))
{
return false;
}
TSubclassOf<AAdvKitCharacter> Class = ForCharacterClass;
return CreateTransitionBetween_Implementation(Class, SourceZone, TargetZone);
}
However that is no permanent fix and it also adds unecessary overhead to every method. I don’t want to change my code to use UClass* because if a TSubclassOf is exposed in Blueprint the editor automatically filters the class list to show only applicable ones.
Kind Regards,