# Looking for better way to play with Bitmask

**URL:** <https://forums.unrealengine.com/t/looking-for-better-way-to-play-with-bitmask/1168679>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint\
**Created:** [May 17, 2023, 12:41pm UTC](https://forums.unrealengine.com/t/looking-for-better-way-to-play-with-bitmask/1168679 "2023-05-17T12:41:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [June 15, 2023, 5:19pm UTC](https://forums.unrealengine.com/t/looking-for-better-way-to-play-with-bitmask/1168679/3 "2023-06-15T17:19:37Z")

</div>

Was able to find a C++ method to use enums with more then 8 bits (so up to int32 maybe int64 but that would not be Net Replicatable)  
detailed here:

> [@Problems with making large bitmasks](https://forums.unrealengine.com/t/problems-with-making-large-bitmasks/485436):
>
> 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. Example: So I had to find some alternative. And I shortly after figured out that I could also just drop …

Note: you can only have 1 non `enum class` per file; so if you only really need 1 of these relative to a UCLASS then you can declare it in the same header as the UCLASS, but if you need another you will need to have it declared and included from another file for each of them.

---

_[View the full topic](https://forums.unrealengine.com/t/looking-for-better-way-to-play-with-bitmask/1168679)._
