I’m getting this error when dispatching lambda that loads glTF object in a background thread.
Since creating objects during garbage collection cycle is not allowed, how code in background should avoid/check for that? Does it mean that this kind of check needs to be done before every background thread execution that deals with UObjects? What about the plugin code (like my example) where its unclear what is being allocated/deallocated inside the plugin?
Or is it just thread contention issue and something is not properly set up in my code? Any insights would be helpful!
Here’s the callstack of the error:
Assertion failed: !IsGarbageCollecting() [File:E:/UnrealEngine/UE_Main/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp] [Line: 2367] Unable to create new object: AssetImportData /Engine/Transient.SkeletalMesh_0.AssetImportData. Creating UObjects while Collecting Garbage is not allowed!
UE4Editor_Core!AssertFailedImplV() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:104]
UE4Editor_Core!FDebug::CheckVerifyFailedImpl() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:461]
UE4Editor_CoreUObject!<lambda_2bcb0bc4dbc924c8a72f269ef2bcdaae>::operator()() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2366]
UE4Editor_CoreUObject!StaticAllocateObject() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2366]
UE4Editor_CoreUObject!StaticConstructObject_Internal() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:3229]
UE4Editor_Engine!USkeletalMesh::PostInitProperties() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\Engine\Private\SkeletalMesh.cpp:449]
UE4Editor_CoreUObject!FObjectInitializer::PostConstructInit() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2891]
UE4Editor_CoreUObject!FObjectInitializer::~FObjectInitializer() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2744]
UE4Editor_CoreUObject!StaticConstructObject_Internal() [E:\UnrealEngine\UE_Main\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:3235]
UE4Editor_glTFRuntime!FglTFRuntimeSkeletalMeshContext::FglTFRuntimeSkeletalMeshContext() [D:\wkspaces\MyProject\Plugins\MyGame\Social\glTFRuntime\Source\glTFRuntime\Public\glTFRuntimeParser.h:783]
UE4Editor_glTFRuntime!FglTFRuntimeParser::LoadSkeletalMeshRecursiveAsync() [D:\wkspaces\MyProject\Plugins\MyGame\Social\glTFRuntime\Source\glTFRuntime\Private\glTFRuntimeParserSkeletalMeshes.cpp:1210]
UE4Editor_glTFRuntime!UglTFRuntimeAsset::LoadSkeletalMeshRecursiveAsync() [D:\wkspaces\MyProject\Plugins\MyGame\Social\glTFRuntime\Source\glTFRuntime\Private\glTFRuntimeAsset.cpp:306]
UE4Editor_MyGame!<lambda_92d524716833cd50d8d71ef497b5b91a>::operator()() [D:\wkspaces\MyProject\Plugins\MyGame\Social\MyGame\Source\MyGame\CharacterAvatarLoader\CharacterAvatarLoader.cpp:592]
UE4Editor_MyGame!journee::utility::PriorityThreadPool::processJob() [D:\wkspaces\MyProject\Plugins\MyGame\Social\MyGame\Source\MyGame\Utility\PriorityThreadPool.cpp:126]
UE4Editor_MyGame!std::thread::_Invoke<std::tuple<std::_Binder<std::_Unforced,void (__cdecl journee::utility::PriorityThreadPool::*)(unsigned int),journee::utility::PriorityThreadPool *,unsigned __int64 &> >,0>() [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\INCLUDE\thread:56]
ucrtbase
kernel32
ntdll