UEnum Bitflags end up getting re-mapped by index in BP, so if you manually specify the enum bit in C++, it won’t be the same once marked as an enum bitflag.
This is how I am using them in C++:
UENUM(BlueprintType, meta = (Bitflags))
enum class EMyEnum: uint8
{
None, //0
Item1, //1
Item2, //2
Item3, //3
};
ENUM_CLASS_FLAGS(EMyEnum)
...
UPROPERTY(SaveGame, EditAnywhere, BlueprintReadWrite, Category = "Stats", meta = (Bitmask, BitmaskEnum = "EMyEnum"))
INT32 Flags;
...
bool HasFlag(const INT32& Flags, EMyEnum TestFlag)
{
INT32 bitFlag = static_cast<int32>(1 << (INT32)TestFlag); //shift to the bit corresponding to the enum value
return (Flags & bitFlag ) != 0;
}