Skip to content

Commit af755f4

Browse files
committed
Update README mentioning Flags attribute support
1 parent 7208dc4 commit af755f4

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,34 @@ Bit masks are readonly structs implementing `IReadOnlySet` for enums:
88
- `EnumBitMask32<T>`: uses `int` as data, supporting enums with up to 32 values.
99
- `EnumBitMask64<T>`: uses `long` as data, supporting enums with up to 64 values.
1010

11+
All implementations support enums both with and without `[Flags]` attributes.
12+
1113
Conversions between enum values and integer types are non-boxing where possible
1214
by using unsafe utilities from Unity, .NET 5+ or .NET Core 3.0+
1315

1416
## Unity Property Drawer
1517
In Unity, there's a custom property drawer for selecting the containing enums:
1618

1719
```cs
18-
using EnumBitSet;
20+
using System;
1921
using UnityEngine;
22+
using EnumBitSet;
2023

21-
public class ScriptWithEnumSet : MonoBehaviour
24+
public class ScriptWithBitSet : MonoBehaviour
2225
{
23-
public enum TestEnum
26+
public enum TesteEnum
2427
{
2528
Zero, One, Two, Three
2629
}
2730

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;
3039
}
3140
```
3241

0 commit comments

Comments
 (0)