Crash in DuplicateObject<USkeletalMesh>() when data is Cooked

Hello,

I have this issue that appeared in 5.5.1 and 5.5.2.

I created two minimal projects that are exactly the same (based on third person demo from unreal) with the added code to duplicate the skeletal mesh of the main character in the demo. When I cook the data and run the game in standalone it causes a crash in part of the code that has Nanite::FResources::Serialize in the callstack, inside the DuplicateObject.

The other project has the same structure but is using 5.4.4 - everything works fine, standalone and editor.

If anyone know anything about this, please do tell. My suspicion is that this is due to all the Nanite changes that came with 5.5. Oh and btw, turning nanite on or off on the mesh that is getting duplicated changes nothing.

Epic just released 5.5.3 which had a critical fix for something related to USkeletalMesh.

Maybe that fixes the issue? Fingers crossed, good luck!

I just tried 553 and it still crashes on
DuplicateObject<USkeletalMesh>()

this issue is pretty severe for us and is preventing us from being able to ship.

Is epic working on a fix?

What are you doing that requires you to duplicate a skeletal mesh in a packaged build? Those are assets and usually those aren’t things that you’d create or want to modify in a shipped game.

Without having the actual callstack it’s really hard to hazard a guess but there are references to target platform and cooking in FResource::Serialize that I would be surprised if they were supported outside of the editor/cooker.

We are loading the template skeletal mesh, applying some complex changes to its geometry with:

RHICmdList.LockBuffer() and RHICmdList.UnlockBuffer()

in the render thread, then repeating the process for the next instance. This is how we prepare them for rendering so that they all look unique.

The problem is, when the geometry is not duplicated, all the instances end up using the same geometry and they all end up looking the same.

Here is the callstack:

duplication_test-Win64-DebugGame.exe!UE::Logging::Private::BasicFatalLog(struct FLogCategoryBase const &,struct UE::Logging::Private::FStaticBasicLogRecord const *,...)
duplication_test-Win64-DebugGame.exe!FDuplicateDataReader::Serialize(void *,__int64)
duplication_test-Win64-DebugGame.exe!Nanite::FResources::SerializeInternal(class FArchive &,class UObject *,bool)
duplication_test-Win64-DebugGame.exe!Nanite::FResources::Serialize(class FArchive &,class UObject *,bool)
duplication_test-Win64-DebugGame.exe!FSkeletalMeshRenderData::Serialize(class FArchive &,class USkinnedAsset *)
duplication_test-Win64-DebugGame.exe!USkeletalMesh::Serialize(class FArchive &)
duplication_test-Win64-DebugGame.exe!StaticDuplicateObjectEx(struct FObjectDuplicationParameters &)
duplication_test-Win64-DebugGame.exe!StaticDuplicateObject(class UObject const *,class UObject *,class FName,enum EObjectFlags,class UClass *,enum EDuplicateMode::Type,enum EInternalObjectFlags)
duplication_test-Win64-DebugGame.exe!DuplicateObject_Internal(class UClass *,class UObject const *,class UObject *,class FName)
duplication_test-Win64-DebugGame.exe!DuplicateObject<USkeletalMesh>(const TObjectPtr<USkeletalMesh> & SourceObject, UObject * Outer, const FName Name) Line 1864
	at C:\Program Files\Epic Games\UE_5.5\Engine\Source\Runtime\CoreUObject\Public\UObject\UObjectGlobals.h(1864)
duplication_test-Win64-DebugGame.exe!UDDEditableSkeletalMeshComponent::BeginPlay() Line 19
	at C:\Projects\duplication_test_5_5\Source\duplication_test\DDEditableSkeletalMeshComponent.cpp(19)
[External Code]
duplication_test-Win64-DebugGame.exe!Aduplication_testCharacter::BeginPlay() Line 99
	at C:\Projects\duplication_test_5_5\Source\duplication_test\duplication_testCharacter.cpp(99)
[External Code]