Bitmask Enum incorrect values

I have a bitmask enum I’ve declared in the following manner:

UENUM(BlueprintType, meta = (Bitflags))
enum class EDoorKeys : uint8
{
	Key1= 1 UMETA(DisplayName = "Some Key"),
	Key2 2 UMETA(DisplayName = "Some Key 2"),
	Key3 = 4 UMETA(DisplayName = "Some Key 3"),
	Key4 = 8 UMETA(DisplayName = "Some Key 4"),
	Key5 = 16 UMETA(DisplayName = "Some Key 5"),
	Key 6 = 32 UMETA(DisplayName = "Some Key 6")
};
ENUM_CLASS_FLAGS(EDoorKeys)

I’m using in an actor as follows:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Variables|Inventory",
		meta = (Bitmask, BitmaskEnum = "EDoorKeys"))
		int32 currentKeys2;

However when I’m checking its values as I’m manipulating it, Key1 maps to a value of 2; Key 2 maps to a value of 4; Key3 maps to a value of 16; Key 4 maps to a value of 256; Key5 maps to a value of 65,536 and Key6 is unusable.

Oddly, when I print out the value of one of the enum values on its own I.e:

GEngine->AddOnScreenDebug(....FString::FromInt((int)EDoorKeys::KeyX);

It prints out the value I would expect, Where X is 1 or 6, I’d get 1 or 32.

I’ve tried changing the values to use a hexadecimal value instead in case that did something, but to no avail, I also tried using the actor variable as a uint8, but then I only have access to the first 3 options. Does anyone have any ideas?

Having looked around a bit more, it seems this issue is covered by bug UE-32816.

The bug outlines that it is actually as intended functionality, and the bitmask values, rather than 1, 2, 4, 8 … it should simply be 1, 2, 3, 4, 5… where the value is actually interpreted as 1 << N rather than N itself.

I’m unsure if I should delete my post at this point or leave this here for posterity.

Adding a link to the doc, for other people to see: Properties | Unreal Engine 4.27 Documentation
If you want to use enum values as bitflags, you can use the meta tag UseEnumValuesAsMaskValuesInEditor.