File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,26 @@ private string GetAssetGuid(TextAsset asset)
7474 {
7575 return UnityEditor . AssetDatabase . AssetPathToGUID ( UnityEditor . AssetDatabase . GetAssetPath ( asset ) ) ;
7676 }
77+
78+ /// <summary>
79+ /// Called when the asset is modified in the Inspector
80+ /// Triggers sync to handle file additions/removals
81+ /// </summary>
82+ private void OnValidate ( )
83+ {
84+ // Cleanup stale states immediately
85+ CleanupStaleStates ( ) ;
86+
87+ // Trigger sync after a delay to handle file removals
88+ // Delay ensures the asset is saved before sync runs
89+ UnityEditor . EditorApplication . delayCall += ( ) =>
90+ {
91+ if ( this != null ) // Check if asset still exists
92+ {
93+ MCPForUnity . Editor . Helpers . PythonToolSyncProcessor . SyncAllTools ( ) ;
94+ }
95+ } ;
96+ }
7797 }
7898
7999 [ Serializable ]
You can’t perform that action at this time.
0 commit comments