@@ -82,42 +82,40 @@ public override void OnInspectorGUI()
8282 FindChangeHandlerMethods ( property ) ;
8383 }
8484
85- if ( ! changeCheckScope . changed
86- || ! Application . isPlaying
87- || targetObject is Behaviour behaviour && ! behaviour . isActiveAndEnabled )
85+ if ( changeCheckScope . changed
86+ && Application . isPlaying
87+ && ( ! ( targetObject is Behaviour behaviour ) || behaviour . isActiveAndEnabled )
88+ && ChangeHandlerMethodInfos . Count > 0 )
8889 {
89- if ( changeCheckScope . changed )
90- {
91- ApplyModifiedProperty ( property , ChangeHandlerMethodInfos . Count > 0 ) ;
92- }
93-
94- continue ;
95- }
96- }
97-
98- Undo . RecordObject ( targetObject , "Before change handlers" ) ;
99- BeforeChange ( property ) ;
100- Undo . FlushUndoRecordObjects ( ) ;
90+ Undo . RecordObject ( targetObject , "Before change handlers" ) ;
91+ BeforeChange ( property ) ;
92+ Undo . FlushUndoRecordObjects ( ) ;
10193
102- using ( SerializedObject serializedObjectCopy =
103- new SerializedObject ( property . serializedObject . targetObject ) )
104- {
105- SerializedProperty propertyCopy = serializedObjectCopy . GetIterator ( ) ;
106- if ( propertyCopy . Next ( true ) )
107- {
108- do
94+ using ( SerializedObject serializedObjectCopy =
95+ new SerializedObject ( property . serializedObject . targetObject ) )
10996 {
110- if ( propertyCopy . propertyPath != property . propertyPath )
97+ SerializedProperty propertyCopy = serializedObjectCopy . GetIterator ( ) ;
98+ if ( propertyCopy . Next ( true ) )
11199 {
112- property . serializedObject . CopyFromSerializedProperty ( propertyCopy ) ;
100+ do
101+ {
102+ if ( propertyCopy . propertyPath != property . propertyPath )
103+ {
104+ property . serializedObject . CopyFromSerializedProperty ( propertyCopy ) ;
105+ }
106+ }
107+ while ( propertyCopy . Next ( false ) ) ;
113108 }
114109 }
115- while ( propertyCopy . Next ( false ) ) ;
110+
111+ ApplyModifiedProperty ( property , true ) ;
112+ AfterChange ( property ) ;
113+ }
114+ else if ( changeCheckScope . changed )
115+ {
116+ ApplyModifiedProperty ( property , ChangeHandlerMethodInfos . Count > 0 ) ;
116117 }
117118 }
118-
119- ApplyModifiedProperty ( property , true ) ;
120- AfterChange ( property ) ;
121119 }
122120 while ( property . NextVisible ( false ) ) ;
123121 }
0 commit comments