From 37481d661358766ab407d2365a2f4ed3a948e0f4 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Thu, 19 Mar 2026 08:54:44 +0100 Subject: [PATCH] Revert "[.NET] Remove EFS update on reloading assemblies" but with deferred call It turns out this call was needed after all, it ensures new scripts are included in the global class list by updating EFS for them. In my previous PR I must've only tested scripts that have been opened or loaded by the editor at some point so I didn't encounter the bug. This reverts the previous PR but with a deferred call to avoid reintroducing the bug that the PR fixed. Updating EFS here is still too early, so we defer the call to ensure the type info is available. --- .../GodotSharp/Core/Bridge/ScriptManagerBridge.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs index 3ee4853340..342a49e70a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs @@ -356,6 +356,20 @@ namespace Godot.Bridge } } } + + // This method may be called before initialization. + if (NativeFuncs.godotsharp_dotnet_module_is_initialized().ToBool() && Engine.IsEditorHint()) + { + if (_pathTypeBiMap.Paths.Count > 0) + { + Callable.From(() => + { + string[] scriptPaths = _pathTypeBiMap.Paths.ToArray(); + using godot_packed_string_array scriptPathsNative = Marshaling.ConvertSystemArrayToNativePackedStringArray(scriptPaths); + NativeFuncs.godotsharp_internal_editor_file_system_update_files(scriptPathsNative); + }).CallDeferred(); + } + } } [UnmanagedCallersOnly]