Revert "Initialize ScriptingService earlier"

This reverts commit 0566e17b23273feffed0c41ed61f7e56d6e8f1a8.
This commit is contained in:
2024-04-18 19:26:38 +03:00
parent a986ede53f
commit c16ec763c2
8 changed files with 28 additions and 24 deletions

View File

@@ -1248,7 +1248,7 @@ namespace FlaxEngine.Interop
}
[UnmanagedCallersOnly]
internal static void LoadScriptingAssemblyLoadContext()
internal static void ReloadScriptingAssemblyLoadContext()
{
#if FLAX_EDITOR
// Clear all caches which might hold references to assemblies in collectible ALC
@@ -1272,18 +1272,16 @@ namespace FlaxEngine.Interop
FlaxEngine.Json.JsonSerializer.ResetCache();
// Unload the ALC
if (scriptingAssemblyLoadContext != null)
{
bool unloading = true;
scriptingAssemblyLoadContext.Unloading += (alc) => { unloading = false; };
scriptingAssemblyLoadContext.Unload();
bool unloading = true;
scriptingAssemblyLoadContext.Unloading += (alc) => { unloading = false; };
scriptingAssemblyLoadContext.Unload();
while (unloading)
System.Threading.Thread.Sleep(1);
while (unloading)
System.Threading.Thread.Sleep(1);
}
#endif
InitScriptingAssemblyLoadContext();
DelegateHelpers.InitMethods();
#endif
}
[UnmanagedCallersOnly]

View File

@@ -92,6 +92,8 @@ namespace FlaxEngine.Interop
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
InitScriptingAssemblyLoadContext();
DelegateHelpers.InitMethods();
}
#if FLAX_EDITOR