I’ve created an enum and a BlueprintNativeEvent that takes this enum as an argument. Unfortunately when I try to compile the game, compilation fails because the Game.Generated.Cpp file swaps out the argument for a TEnumAsByte instead of a regular enum.
If I manually edit the Generated.CPP file, I can compile - but this is obviously not a good workaround. I don’t want to change my enum to the old ::Type style, since that’ll be a breaking change for other parts of the code.
This is the code I have written:
– .H
UENUM(BlueprintType)
enum class EMissionActivityEvent : uint8
{
ME_None UMETA(DisplayName = "None"),
ME_Scheduled UMETA(DisplayName = "Scheduled"),
ME_Created UMETA(DisplayName = "Created"),
ME_Completed UMETA(DisplayName = "Completed"),
ME_Failed UMETA(DisplayName = "Failed"),
};
UFUNCTION(BlueprintNativeEvent, Category = "Game Widgets")
void OnMissionNotificationAdded(const EMissionActivityEvent& MissionEvent, const FActiveMission& MissionData);
virtual void OnMissionNotificationAdded_Implementation(const EMissionActivityEvent& MissionEvent, const FActiveMission& MissionData);
-- CPP:
void UGESGame_InGameWidget::OnMissionNotificationAdded_Implementation(const EMissionActivityEvent& MissionEvent, const FActiveMission& MissionData)
{
// Code Goes Here
}
And THIS is what the GESGame.Generated.CPP file generates for that UFUNCTION, which as you can see is incorrect:
void UGESGame_InGameWidget::OnMissionNotificationAdded(const TEnumAsByte<EMissionActivityEvent>& MissionEvent, const FActiveMission& MissionData)
{
GESGame_InGameWidget_eventOnMissionNotificationAdded_Parms Parms;
Parms.MissionEvent=MissionEvent;
Parms.MissionData=MissionData;
ProcessEvent(FindFunctionChecked(GESGAME_OnMissionNotificationAdded),&Parms);
}
This stops my game from compiling, but i can change the Generated file and it will compile and run fine.