It seems like it is impossible to have a enum class with 256 values in it (or even one value that is 255)
UENUM()
enum class EByte : uint8 {
Mask = 255,
};
generates a error stating that EByte_Max cannot be automatically defined as 256 because it wraps to zero over 8 bits and that I should manually define it in the enum so…
The above hack gets UHT to stop complaining when there are actually 256 values in the enum, and EByte::Mask exists still. The problem is that Mask does not show up as an option if the enum is a UPROPERTY (neither does EByte_Max, even if UMETA(DisplayName=“Mask”) is used afterwards.
So I was curious if I perhaps am doing something wrong or if when using enum class your really only limited to 255 values, 0…254?
You’re not doing anything wrong. UENUMs silently insert an additional member after the last one, a sort of sentinel value used for reflection I assume. So if “slot 255” is already occupied, UHT will complain about it.
Well that’s painful, but thanks for the response! Would be nice if they could fix it. Seems like they could just treat E…_MAX == 0 special, since your not allowed to have any enum types that are not unsigned 8 bit integers internally and your also not allowed to UENUM an enum with no entries in it.