@@ -6,6 +6,7 @@ public class DisableIfTest : MonoBehaviour
66 {
77 public bool disable1 ;
88 public bool disable2 ;
9+ public DisableIfEnum enum1 ;
910
1011 [ DisableIf ( EConditionOperator . And , "disable1" , "disable2" ) ]
1112 [ ReorderableList ]
@@ -15,6 +16,10 @@ public class DisableIfTest : MonoBehaviour
1516 [ ReorderableList ]
1617 public int [ ] disableIfAny ;
1718
19+ [ DisableIf ( "enum1" , DisableIfEnum . Case0 ) ]
20+ [ ReorderableList ]
21+ public int [ ] disableIfEnum ;
22+
1823 public DisableIfNest1 nest1 ;
1924 }
2025
@@ -23,8 +28,10 @@ public class DisableIfNest1
2328 {
2429 public bool disable1 ;
2530 public bool disable2 ;
31+ public DisableIfEnum enum1 ;
2632 public bool Disable1 { get { return disable1 ; } }
2733 public bool Disable2 { get { return disable2 ; } }
34+ public DisableIfEnum Enum1 { get { return enum1 ; } }
2835
2936 [ DisableIf ( EConditionOperator . And , "Disable1" , "Disable2" ) ]
3037 [ AllowNesting ] // Because it's nested we need to explicitly allow nesting
@@ -34,6 +41,10 @@ public class DisableIfNest1
3441 [ AllowNesting ] // Because it's nested we need to explicitly allow nesting
3542 public int disableIfAny = 2 ;
3643
44+ [ DisableIf ( "Enum1" , DisableIfEnum . Case1 ) ]
45+ [ AllowNesting ]
46+ public int disableIfEnum = 3 ;
47+
3748 public DisableIfNest2 nest2 ;
3849 }
3950
@@ -42,8 +53,10 @@ public class DisableIfNest2
4253 {
4354 public bool disable1 ;
4455 public bool disable2 ;
56+ public DisableIfEnum enum1 ;
4557 public bool GetDisable1 ( ) { return disable1 ; }
4658 public bool GetDisable2 ( ) { return disable2 ; }
59+ public DisableIfEnum GetEnum1 ( ) { return enum1 ; }
4760
4861 [ DisableIf ( EConditionOperator . And , "GetDisable1" , "GetDisable2" ) ]
4962 [ MinMaxSlider ( 0.0f , 1.0f ) ] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
@@ -52,5 +65,18 @@ public class DisableIfNest2
5265 [ DisableIf ( EConditionOperator . Or , "GetDisable1" , "GetDisable2" ) ]
5366 [ MinMaxSlider ( 0.0f , 1.0f ) ] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
5467 public Vector2 enableIfAny = new Vector2 ( 0.25f , 0.75f ) ;
68+
69+ [ DisableIf ( "GetEnum1" , DisableIfEnum . Case2 ) ]
70+ [ MinMaxSlider ( 0.0f , 1.0f ) ] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
71+ public Vector2 enableIfEnum = new Vector2 ( 0.25f , 0.75f ) ;
72+ }
73+
74+ [ System . Serializable ]
75+ public enum DisableIfEnum
76+ {
77+ Case0 ,
78+ Case1 ,
79+ Case2 ,
80+ Case3
5581 }
5682}
0 commit comments