Issue with Enums during Blueprint Nativization

Hi everyone,

I wasn’t sure which forum it was best to post this in, as it’s to do with packaging my project. I want to test a packaged build of my project with full blueprint nativization to see what kind of performance benefit we can get from it, but the C++ code generated by the nativization process seems to have an issue.

I have defined an enum in C++ like so:

In the class header, I have an EFactions variable defined as so:

And in one of the blueprint I have this switch placed in the Event Graph:

However, during the nativization process, I get this error:

'static_cast': cannot convert from 'TEnumAsByte<EFactions>' to 'uint8'

Looking at the nativized code and navigating to the offending line, I see this:

b0lK2Node_SwitchEnum_CmpSuccesspf = UKismetMathLibrary::NotEqual_ByteByte(static_cast<uint8>(DefendingFaction), static_cast<uint8>(EFactions::britain));

It looks like it doesn’t like the static cast in this line of code.

Is anyone able to explain why this is happening and how to resolve it? I get it in all blueprints that reference an enum.


EnumAsByte<> UProperty is legacy code, you should be able to declare the enum as is.

Thanks, looks like one of our coders used it and I didn’t realise! Weirdly, if I build a shipping version of the game with inclusive nativization enabled, the game fails to start. I just get a black screen and the process is dead at 0% CPU usage and always exactly 407mb of memory usage. However, nativization certain assets works fine. Is this a common issue?