File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -8,25 +8,34 @@ Bit masks are readonly structs implementing `IReadOnlySet` for enums:
8
8
- ` EnumBitMask32<T> ` : uses ` int ` as data, supporting enums with up to 32 values.
9
9
- ` EnumBitMask64<T> ` : uses ` long ` as data, supporting enums with up to 64 values.
10
10
11
+ All implementations support enums both with and without ` [Flags] ` attributes.
12
+
11
13
Conversions between enum values and integer types are non-boxing where possible
12
14
by using unsafe utilities from Unity, .NET 5+ or .NET Core 3.0+
13
15
14
16
## Unity Property Drawer
15
17
In Unity, there's a custom property drawer for selecting the containing enums:
16
18
17
19
``` cs
18
- using EnumBitSet ;
20
+ using System ;
19
21
using UnityEngine ;
22
+ using EnumBitSet ;
20
23
21
- public class ScriptWithEnumSet : MonoBehaviour
24
+ public class ScriptWithBitSet : MonoBehaviour
22
25
{
23
- public enum TestEnum
26
+ public enum TesteEnum
24
27
{
25
28
Zero , One , Two , Three
26
29
}
27
30
28
- public EnumBitSet32 <TestEnum > aBitset ;
29
- public EnumBitSet64 <TestEnum > anotherBitset ;
31
+ [Flags ]
32
+ public enum TesteEnumFlags
33
+ {
34
+ Zero = 1 << 0 , One = 1 << 1 , Two = 1 << 2 , Three = 1 << 3
35
+ }
36
+
37
+ public EnumBitSet32 <TesteEnum > aBitset ;
38
+ public EnumBitSet64 <TesteEnumFlags > anotherBitset ;
30
39
}
31
40
```
32
41
You can’t perform that action at this time.
0 commit comments