UStaticMesh::BuildFromMeshDescriptions suddenly taking minutes to complete??

I’ve been working on a project with UE 5.1 where I manually build a mesh with vertices/indices and create a UStaticMesh in C++. I do it in an Actor’s BeginPlay, and then assign it to the actor’s UStaticMeshComponent with SetStaticMesh. This has been working fine for many weeks now, and launching PIE would start instantly, the mesh was correct, etc.

I updated the project to UE 5.2 and suddenly my call to BuildFromMeshDescriptions is taking 2 minutes and 24 seconds to complete! Every time I launch PIE. What can I… what the-

bump I migrated back to 5.1 (which was painful) and the issue went away. Then I created a new 5.2 project, made a new class and copied in the code to create the mesh… and reproduced the issue again.

Is anyone else creating static meshes in code…? Here’s how I’m doing it:

UStaticMesh* MakeStaticMesh(UObject* owner, TCHAR* name, const TArray<uint32_t>& indices, const TArray<FVector3f>& positions, const TArray<TArray<FVector2f>>& uvs, const TArray<FVector3f>& normals, const TArray<FVector4f>& colors)
{
	bool hasNormals = normals.Num() > 0;
	bool hasColors = colors.Num() > 0;

	FMeshDescription meshDesc;
	FStaticMeshAttributes attributes(meshDesc);
	attributes.Register();

	FMeshDescriptionBuilder meshDescBuilder;
	meshDescBuilder.SetMeshDescription(&meshDesc);
	meshDescBuilder.EnablePolyGroups();
	meshDescBuilder.SetNumUVLayers(uvs.Num());

	TArray<FVertexInstanceID> vertexInsts;
	TArray<FVertexID> vertexIDs;

	vertexIDs.SetNum(positions.Num());
	for(int32_t i = 0; i < positions.Num(); i++)
	{
		vertexIDs[i] = meshDescBuilder.AppendVertex(FVector(positions[i]));
		FVertexInstanceID instance = meshDescBuilder.AppendInstance(vertexIDs[i]);
		for(int32_t j = 0; j < uvs.Num(); j++)
			meshDescBuilder.SetInstanceUV(instance, FVector2D(uvs[j][i]), j);
		if(hasNormals)
			meshDescBuilder.SetInstanceNormal(instance, FVector(normals[i]));
		if(hasColors)
			meshDescBuilder.SetInstanceColor(instance, colors[i]);
		vertexInsts.Add(instance);
	}

	FPolygonGroupID polygonGroup = meshDescBuilder.AppendPolygonGroup();
	for(int32_t i = 0; i < indices.Num(); i += 3)
		meshDescBuilder.AppendTriangle(vertexInsts[indices[i]], vertexInsts[indices[i + 1]], vertexInsts[indices[i + 2]], polygonGroup);

	// At least one material must be added
	UStaticMesh* staticMesh = NewObject<UStaticMesh>(owner);
	staticMesh->GetStaticMaterials().Add(FStaticMaterial());

	UStaticMesh::FBuildMeshDescriptionsParams mdParams;
	mdParams.bBuildSimpleCollision = false;
	mdParams.bFastBuild = true;

	// Build static mesh
	TArray<const FMeshDescription*> meshDescPtrs;
	meshDescPtrs.Emplace(&meshDesc);
	staticMesh->BuildFromMeshDescriptions(meshDescPtrs, mdParams);
	staticMesh->CalculateExtendedBounds();

	return staticMesh;
}

Did you ever come up with an answer? I just upgraded to 5.4 from 4.27 and am encountering this.