diff options
author | chai <chaifix@163.com> | 2020-10-15 07:04:38 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-15 07:04:38 +0800 |
commit | b71d5611db087772179505ed10c82ca958900df7 (patch) | |
tree | 5160f6af41d45529e435550879e0c87ea59c09a8 /Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs | |
parent | b1b14c45ce95dcf7b81867d68d6006345d98959e (diff) |
+advanced inspector
Diffstat (limited to 'Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs')
-rw-r--r-- | Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs b/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs new file mode 100644 index 00000000..ae8426e2 --- /dev/null +++ b/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample8_Enum.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using System.Collections; + +using AdvancedInspector; + +[AdvancedInspector] +public class AIExample8_Enum : MonoBehaviour +{ + [Inspect] + public MyEnum normalEnum; + + // The enum attribute is used to control how an enum is displayed. + // The first parameter is a switch between a normal 1-choice enum, and a masked enum. + [Inspect, Enum(true)] + public MyEnum maskedEnum; + + // An enum can also be display as checkboxes or buttons + [Inspect, Enum(EnumDisplay.Checkbox)] + public MyEnum checkboxEnum; + + [Inspect] + public ByteEnum byteEnum; +} + +public enum MyEnum +{ + // Masked enum - or bitfield - must follow a bitwise values. (1, 2, 4, 8, 16, 32, 64, etc) + // Otherwise the bitfield cannot be save properly. + // Unity has issue with a masked value of an enum having a 0 value. + // None = 0, + FirstValue = 1, + SecondValue = 2, + ThirdValue = 4, + ForthValue = 8 +} + +public enum ByteEnum : byte +{ + One = 1, + Two = 2, + Three = 3 +}
\ No newline at end of file |