Merge branch 'GoaLitiuM-custom_asset_hotreload'
This commit is contained in:
@@ -640,9 +640,9 @@ void Scripting::Reload(bool canTriggerSceneReload)
|
|||||||
MCore::GC::WaitForPendingFinalizers();
|
MCore::GC::WaitForPendingFinalizers();
|
||||||
|
|
||||||
// Destroy objects from game assemblies (eg. not released objects that might crash if persist in memory after reload)
|
// Destroy objects from game assemblies (eg. not released objects that might crash if persist in memory after reload)
|
||||||
|
const auto flaxModule = GetBinaryModuleFlaxEngine();
|
||||||
_objectsLocker.Lock();
|
_objectsLocker.Lock();
|
||||||
{
|
{
|
||||||
const auto flaxModule = GetBinaryModuleFlaxEngine();
|
|
||||||
for (auto i = _objectsDictionary.Begin(); i.IsNotEnd(); ++i)
|
for (auto i = _objectsDictionary.Begin(); i.IsNotEnd(); ++i)
|
||||||
{
|
{
|
||||||
auto obj = i->Value;
|
auto obj = i->Value;
|
||||||
@@ -657,6 +657,15 @@ void Scripting::Reload(bool canTriggerSceneReload)
|
|||||||
}
|
}
|
||||||
_objectsLocker.Unlock();
|
_objectsLocker.Unlock();
|
||||||
|
|
||||||
|
// Release assets sourced from game assemblies
|
||||||
|
for (auto asset : Content::GetAssets())
|
||||||
|
{
|
||||||
|
if (asset->GetTypeHandle().Module == flaxModule)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
asset->DeleteObjectNow();
|
||||||
|
}
|
||||||
|
|
||||||
// Unload all game modules
|
// Unload all game modules
|
||||||
LOG(Info, "Unloading game binary modules");
|
LOG(Info, "Unloading game binary modules");
|
||||||
auto modules = BinaryModule::GetModules();
|
auto modules = BinaryModule::GetModules();
|
||||||
|
|||||||
Reference in New Issue
Block a user