Enumertation differences in bp and c++

Hello when creating a BP Enum there are differences in what variable names are allowed compared to a C++ Enum, in my case I want to have the variable names inside the enum be 1, 2, 3, 4, 5 and that’s fine for a BP Enum but when trying to do it in a C++ Enum I just get an error. The error is presumably because it isn’t allowed but how does the engine parse it and make it work then? What could be my workarounds?

The Enum has numeric names because it is used for handling speed and I know that I could just switch on int but with the Enum I can easily see which values should be allowed and it becomes a lot easier to upkeep.

In pure C++, an enum will have a backing int value like so

enum MyEnum {
    Open = 0,
    Closed = 1,
    Locked = 100,

With UE4 UEnums, the engine uses metadata to add more details to an enum value (so you can see user friendly names in the editor). This is done like this:

enum class EDoorState : uint8 {
	Open			UMETA(DisplayName = "Door Open"),
	Closed			UMETA(DisplayName = "Door Closed"),
	Locked	= 100	UMETA(DisplayName = "Door Locked")

You can grab these values from the UEnum class. Have a look at this wiki for more info

If you want valid numbers for constraint checking with integer values, try using a TSet instead. It would be much faster