How serialize array of custom UObject?

So, for anyone here in the future, serializing a UObject is a little trickier, basically you have two options: create a struct with the data of your UObject, or customize the Serialize function to handle the UObject creation/copy

With structs

Just create a Struct with all the data you want to serialize/desserialize, then do something like this:

USTRUCT(BlueprintType)
struct FBlockData
{
	GENERATED_BODY()

	FBlockData()
	{
	}

	FBlockData(TSubclassOf<UBlock> InBlockType)
	{
		BlockType = InBlockType;
	}

	UPROPERTY()
	TSubclassOf<UBlock> BlockType = UBlock::StaticClass();

	void Serialize(FArchive& Ar)
	{
		Ar << BlockType;
	}
};

FORCEINLINE FArchive& operator<<(FArchive& Ar, FBlockData& BlockData)
{
	BlockData.Serialize(Ar);
	return Ar;
}

Custom Serialize

As the pointers of the objects only make senses in the context of the game, and they also are deleted when the game closes, we have to gatter all the important data from the object then save it to Archive, and for the deserialization we initialize a new object then insert the data from the Archive:

void UChunks::Serialize(FArchive& Ar)
{
	if (Ar.IsSaving())
	{
		int32 Objects = ChunksData.Num();
		Ar << Objects;

        // In my case ChunksData is a TMap<FVector2D, UBlockArray3D*>
		for (auto& Pair : ChunksData)
		{
			Ar << Pair.Key;
			Pair.Value->Serialize(Ar);
		}
	}
	else if (Ar.IsLoading())
	{
		int32 Objects = 0;
		Ar << Objects;

		for (int i = 0; i < Objects; i++)
		{
			FVector2D Key;
			Ar << Key;

			UBlockArray3D* Value = NewObject<UBlockArray3D>(this);
			Ar << Value;

			ChunksData.Add(Key, Value);
		}
	}
}

Extra
I know there is a FObjectAndNameAsStringProxyArchive which allow to serialize TSubclassOf objects easily, I haven’t tested if it handles the serialization/deserialization of UObjects too.