Separate managed assembly unloading and scripting ALC reinitialization

Fixes an issue with multiple managed assemblies unloading and releasing
all cached data before native resources were fully released in other
assemblies.
This commit is contained in:
2023-08-08 17:35:13 +03:00
parent f29cd1b7b8
commit 9d8105e3f3
6 changed files with 33 additions and 26 deletions

View File

@@ -706,7 +706,9 @@ void Scripting::Reload(bool canTriggerSceneReload)
modules.Clear();
_nonNativeModules.ClearDelete();
_hasGameModulesLoaded = false;
MCore::OnMidHotReload();
// Release and create a new assembly load context for user assemblies
MCore::ReloadScriptingAssemblyLoadContext();
// Give GC a try to cleanup old user objects and the other mess
MCore::GC::Collect();