Massive frame drops when setting material to a DynamicMeshComponent

Issue :
MeshComponent->SetMaterial(0, Material),
where MeshComponent is a UDynamicMeshComponent*,
causes my frames to go from a stable 120 fps to 40. Commenting this fixes all issues. It does not matter whether I am generating UV’s, tangents or normal’s and can’t find any useful information when profiling.

It does not matter whether Material is a UMaterial*, UMaterialInstance*, UMaterialInsntaceDynamic*, etc. Or if its null or not.

MeshComponent->SetMaterial(0, nullptr) causes the exact same issue

Code :

//Making a FDynamicMesh3
Mesh = MakeUnique<FDynamicMesh3>();
Mesh->EnableAttributes();
Mesh->EnableVertexUVs(FVector2f::Zero());

//Positions and UV's
for (int32 x = 0; x <= Size; x++)
	{
		for (int32 y = 0; y <= Size; y++)
		{
			float z = FMath::PerlinNoise2D(FVector2D(x * NoiseScale, y * NoiseScale));
			int32 VertexID = Mesh->AppendVertex(FVector3d(x * ScaleFactor, y * ScaleFactor, z * HeightScale));
			Mesh->SetVertexUV(VertexID, FVector2f(x, y));
		}
	}

//Triangles
for (int32 x = 0; x < Size; x++)
	{
		for (int32 y = 0; y < Size; y++)
		{
			int32 topLeft = x * (Size + 1) + y;
			int32 topRight = topLeft + 1;
			int32 bottomLeft = (x + 1) * (Size + 1) + y;
			int32 bottomRight = bottomLeft + 1;

			Mesh->AppendTriangle(topLeft, topRight, bottomLeft);
			Mesh->AppendTriangle(bottomLeft, topRight, bottomRight);
		}
	}

//Mesh Creation
UE::Geometry::FMeshNormals::QuickComputeVertexNormals(*Mesh);
CopyVertexUVsToOverlay(*Mesh, *Mesh->Attributes()->PrimaryUV());
MeshComponent->SetMesh(MoveTemp(*Mesh));
MeshComponent->SetMaterial(0, Material); 


//I initialize MeshComponent in the consctructor
MeshComponent = CreateDefaultSubobject<UDynamicMeshComponent>(TEXT("CustomMeshComponent"));
MeshComponent->AttachToComponent(GetRootComponent(), FAttachmentTransformRules::KeepRelativeTransform);