@@ -88,13 +88,18 @@ public static bool IsEnabled(SerializedProperty property)
8888 if ( enableIfAttribute . EnumValue != null )
8989 {
9090 Enum value = GetEnumValue ( target , enableIfAttribute . Conditions [ 0 ] ) ;
91- if ( value != null ) return enableIfAttribute . EnumValue . Equals ( value ) != enableIfAttribute . Inverted ;
92-
91+ if ( value != null )
92+ {
93+ return enableIfAttribute . EnumValue . Equals ( value ) != enableIfAttribute . Inverted ;
94+ }
95+
9396 string message = enableIfAttribute . GetType ( ) . Name + " needs a valid enum field, property or method name to work" ;
9497 Debug . LogWarning ( message , property . serializedObject . targetObject ) ;
98+
9599 return false ;
96100 }
97101
102+ // deal with normal conditions
98103 List < bool > conditionValues = GetConditionValues ( target , enableIfAttribute . Conditions ) ;
99104 if ( conditionValues . Count > 0 )
100105 {
@@ -124,13 +129,18 @@ public static bool IsVisible(SerializedProperty property)
124129 if ( showIfAttribute . EnumValue != null )
125130 {
126131 Enum value = GetEnumValue ( target , showIfAttribute . Conditions [ 0 ] ) ;
127- if ( value != null ) return showIfAttribute . EnumValue . Equals ( value ) != showIfAttribute . Inverted ;
128-
132+ if ( value != null )
133+ {
134+ return showIfAttribute . EnumValue . Equals ( value ) != showIfAttribute . Inverted ;
135+ }
136+
129137 string message = showIfAttribute . GetType ( ) . Name + " needs a valid enum field, property or method name to work" ;
130138 Debug . LogWarning ( message , property . serializedObject . targetObject ) ;
139+
131140 return false ;
132141 }
133142
143+ // deal with normal conditions
134144 List < bool > conditionValues = GetConditionValues ( target , showIfAttribute . Conditions ) ;
135145 if ( conditionValues . Count > 0 )
136146 {
@@ -156,15 +166,21 @@ internal static Enum GetEnumValue(object target, string enumName)
156166 {
157167 FieldInfo enumField = ReflectionUtility . GetField ( target , enumName ) ;
158168 if ( enumField != null && enumField . FieldType . IsSubclassOf ( typeof ( Enum ) ) )
159- return ( Enum ) enumField . GetValue ( target ) ;
160-
169+ {
170+ return ( Enum ) enumField . GetValue ( target ) ;
171+ }
172+
161173 PropertyInfo enumProperty = ReflectionUtility . GetProperty ( target , enumName ) ;
162174 if ( enumProperty != null && enumProperty . PropertyType . IsSubclassOf ( typeof ( Enum ) ) )
163- return ( Enum ) enumProperty . GetValue ( target ) ;
164-
175+ {
176+ return ( Enum ) enumProperty . GetValue ( target ) ;
177+ }
178+
165179 MethodInfo enumMethod = ReflectionUtility . GetMethod ( target , enumName ) ;
166180 if ( enumMethod != null && enumMethod . ReturnType . IsSubclassOf ( typeof ( Enum ) ) )
167- return ( Enum ) enumMethod . Invoke ( target , null ) ;
181+ {
182+ return ( Enum ) enumMethod . Invoke ( target , null ) ;
183+ }
168184
169185 return null ;
170186 }
0 commit comments