FNativeClassHeaderGenerator::ExportEnum produces this behavior.
If an enum has “MAX” somewhere in the array, it removes last element.
I tested my code to fix the issue.
// code placeholder bool UEnum::ContainsExistingMax() const { #if 1 // testcode const int32 LastElementIndex = Names.Num()-1; if (GetIndexByName(*GenerateFullEnumName(TEXT("MAX")), EGetByNameFlags::CaseSensitive) == LastElementIndex ) { return true; } FName MaxEnumItem = *GenerateFullEnumName(*(GenerateEnumPrefix() + TEXT("_MAX"))); if (GetIndexByName(MaxEnumItem, EGetByNameFlags::CaseSensitive) == LastElementIndex ) { return true; } #else if (GetIndexByName(*GenerateFullEnumName(TEXT("MAX")), EGetByNameFlags::CaseSensitive) != INDEX_NONE ) { return true; } FName MaxEnumItem = *GenerateFullEnumName(*(GenerateEnumPrefix() + TEXT("_MAX"))); if (GetIndexByName(MaxEnumItem, EGetByNameFlags::CaseSensitive) != != INDEX_NONE ) { return true; } #endif return false; }
The "Get number of entries" returns 4 in above example.
for example define enum with following code
UENUM(BlueprintType) enum class EMaxTest2 : uint8 { A, B, MAX, C };
UHT removes last element "C".
"Get number of entries" node returns 3.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-82048 in the post.
0 |
Component | UE - Foundation - Core |
---|
Created | Oct 18, 2019 |
---|---|
Resolved | Aug 27, 2021 |
Updated | Aug 27, 2021 |