I use the ParallelFor to increase speed to convert local file to unreal assests,so in ParallelFor lambda function i use the UPackage to create package,but when i import the file it came the error
[Assertion failed: IsInGameThread() [File:D:/UnrealEngine-4.26.2-release/Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp] [Line: 1335] ]
The import code List here:
ParallelFor(FileNameMapNum, [&](int32 id) {
UPackage* Package = CreatePackage(NULL, AssetPath);
Package->FullyLoad();
UVolumeTexture volumeTexture= NewObject(Package, *TextureName, RF_Public | RF_Standalone | RF_MarkAsRootSet);
//Then i fill the volumeTexture to the new create volume Texture object
Package->MarkPackageDirty();
FAssetRegistryModule::AssetCreated(volumeTexture);
FString PackageFileName = FPackageName::LongPackageNameToFilename(AssetPath, FPackageName::GetAssetPackageExtension());
bool bSaved = UPackage::SavePackage(Package, volumeTexture, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, *PackageFileName, GError, nullptr, true, true, SAVE_NoError);
}, EParallelForFlags::BackgroundPriority);
Can someone tell me UPackage can or not use in the ParallelFor?