Hi, I have been struggeling a lot for a long time today trying to set up a proper working enum to use as a bitmask.
I have looked through countless articles and here are my findings…
The prefferable way to set up an enum seems to be to add in the class keyword.
Though this has to inherit from uint8 which does not support more than a maximum of 8 bits worth of values.
So I had to find some alternative. And I shortly after figured out that I could also just drop the class keyword and don’t need it inherit it from uint8. Though this lead me into my next problem, I have several enums i need to define, and it was complaining that None was already defined. While it should be hidden and could technically be called anything else. Its fairly prone to overlapping names eventually.
The only solution I was able to find for this, was to put the enum inside a namespace. Which did allow it to compile but I was no longer able to see the value names of my enums in the editor mask field. They all displayed as “Flag 1-32”. I’m assuming this is somehow related with the UPROPERTY Meta Specifier not being able to find the proper enum to map it too, thus displaying a standard int32 as a bitmask. I named my namespaces the same name as the enumerator (removing the E prefix) and I have attempted all combinations of trying to have the BitmaskEnum find this. But all of them seems to fail at finding any value names.
My final solution, just make a separate file for each enum, and drop the namespaces. It will no longer complain about “None” already being defined in another file. It compiles, and works as intended. Hope someone else finds this useful and dont have to go through the same struggles.