Fix objects creation to ensure managed object ctor is always executed

#3245
This commit is contained in:
Wojtek Figat
2025-03-03 19:12:29 +01:00
parent 3200fc1570
commit e82bb639ed
5 changed files with 30 additions and 17 deletions

View File

@@ -874,6 +874,7 @@ Asset* Content::CreateVirtualAsset(const ScriptingTypeHandle& type)
LOG(Error, "Cannot create virtual asset object.");
return nullptr;
}
asset->RegisterObject();
// Call initializer function
asset->InitAsVirtual();
@@ -1041,6 +1042,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type)
LOAD_FAILED();
}
#endif
result->RegisterObject();
// Register asset
AssetsLocker.Lock();