@@ -117,6 +117,7 @@ internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings
117117 private bool projectSettingsDirty ;
118118 private bool inspectorSettingsDirty ;
119119 private bool sceneViewSettingsDirty ;
120+ private int lastValidationFrame ;
120121
121122 internal event Action < IToolboxHierarchySettings > OnHierarchySettingsChanged ;
122123 internal event Action < IToolboxProjectSettings > OnProjectSettingsChanged ;
@@ -179,13 +180,25 @@ internal void ValidateSceneViewSettings()
179180
180181 internal void Validate ( )
181182 {
183+ Validate ( false ) ;
184+ }
185+
186+ internal void Validate ( bool force )
187+ {
188+ //NOTE: additional check to prevent multiple validations in the same frame, e.g. typical case:
189+ // - after recompilation we are initializing toolbox and we want to validate settings, in the same time Unity validates all SOs
190+ if ( lastValidationFrame == Time . frameCount && ! force )
191+ {
192+ return ;
193+ }
194+
182195 ValidateHierarchySettings ( ) ;
183196 ValidateProjectSettings ( ) ;
184197 ValidateInspectorSettings ( ) ;
185198 ValidateSceneViewSettings ( ) ;
199+ lastValidationFrame = Time . frameCount ;
186200 }
187201
188-
189202 /// <summary>
190203 /// Called internally by the Editor after any value change or the Undo/Redo operation.
191204 /// </summary>
@@ -334,7 +347,6 @@ public void ResetIconRectProperties()
334347 Defaults . smallFolderIconYPaddingDefault ) ;
335348 }
336349
337-
338350 public bool UseToolboxHierarchy
339351 {
340352 get => useToolboxHierarchy ;
0 commit comments