@@ -534,10 +534,6 @@ void CSharpLanguage::frame() {
534534 if (gdmono && gdmono->is_runtime_initialized () && GDMonoCache::godot_api_cache_updated) {
535535 GDMonoCache::managed_callbacks.ScriptManagerBridge_FrameCallback ();
536536 }
537-
538- #ifdef TOOLS_ENABLED
539- _flush_filesystem_updates ();
540- #endif
541537}
542538
543539struct CSharpScriptDepSort {
@@ -1072,47 +1068,6 @@ bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
10721068}
10731069
10741070#ifdef TOOLS_ENABLED
1075- void CSharpLanguage::_queue_for_filesystem_update (String p_script_path) {
1076- if (!Engine::get_singleton ()->is_editor_hint ()) {
1077- return ;
1078- }
1079-
1080- if (p_script_path.is_empty ()) {
1081- return ;
1082- }
1083-
1084- pending_file_system_update_paths.push_back (p_script_path);
1085- }
1086-
1087- void CSharpLanguage::_flush_filesystem_updates () {
1088- if (!Engine::get_singleton ()->is_editor_hint ()) {
1089- return ;
1090- }
1091-
1092- if (pending_file_system_update_paths.is_empty ()) {
1093- return ;
1094- }
1095-
1096- // If the EditorFileSystem singleton is available, update the files;
1097- // otherwise, the files will be updated when the singleton becomes available.
1098- EditorFileSystem *efs = EditorFileSystem::get_singleton ();
1099- if (!efs) {
1100- pending_file_system_update_paths.clear ();
1101- return ;
1102- }
1103-
1104- // Required to prevent EditorProgress within EditorFileSystem from calling this while it is already flushing
1105- if (is_flushing_filesystem_updates) {
1106- return ;
1107- }
1108- is_flushing_filesystem_updates = true ;
1109-
1110- efs->update_files (pending_file_system_update_paths);
1111-
1112- is_flushing_filesystem_updates = false ;
1113- pending_file_system_update_paths.clear ();
1114- }
1115-
11161071void CSharpLanguage::_editor_init_callback () {
11171072 // Load GodotTools and initialize GodotSharpEditor
11181073
@@ -2284,7 +2239,12 @@ void CSharpScript::reload_registered_script(Ref<CSharpScript> p_script) {
22842239 p_script->_update_exports ();
22852240
22862241#ifdef TOOLS_ENABLED
2287- CSharpLanguage::get_singleton ()->_queue_for_filesystem_update (p_script->get_path ());
2242+ // If the EditorFileSystem singleton is available, update the file;
2243+ // otherwise, the file will be updated when the singleton becomes available.
2244+ EditorFileSystem *efs = EditorFileSystem::get_singleton ();
2245+ if (efs && !p_script->get_path ().is_empty ()) {
2246+ efs->update_file (p_script->get_path ());
2247+ }
22882248#endif
22892249}
22902250
@@ -2657,7 +2617,12 @@ Error CSharpScript::reload(bool p_keep_state) {
26572617 _update_exports ();
26582618
26592619#ifdef TOOLS_ENABLED
2660- CSharpLanguage::get_singleton ()->_queue_for_filesystem_update (script_path);
2620+ // If the EditorFileSystem singleton is available, update the file;
2621+ // otherwise, the file will be updated when the singleton becomes available.
2622+ EditorFileSystem *efs = EditorFileSystem::get_singleton ();
2623+ if (efs) {
2624+ efs->update_file (script_path);
2625+ }
26612626#endif
26622627 }
26632628
0 commit comments