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:

https://i.gyazo.com/30b022e9331079860f79bf46edfc1d32.png

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

https://i.gyazo.com/c7bbd455b1d18593d6f08ac12e5fc00b.png

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

https://i.gyazo.com/e1e9bfcd08fee6e8098ac2316102930f.png

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.

Thanks!

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?