FBufferArchive and operator<<

Hi ,
I’m trying to save simple structure into FBufferArchive .

USTRUCT(BlueprintType)
struct FActorRecord
{
	GENERATED_USTRUCT_BODY()

		UPROPERTY(SaveGame)
		TSubclassOf<AActor> ActorClass;

		UPROPERTY(SaveGame)
		FTransform ActorTransform;

		UPROPERTY(SaveGame)
		FString  ActorName;

		UPROPERTY(SaveGame)
		TArray<uint8> ActorData;

	FORCEINLINE friend FArchive& operator<<(FArchive& Ar, FActorRecord& ActorRecord)
	{
		Ar << ActorRecord.ActorClass;
		Ar << ActorRecord.ActorTransform;
		Ar << ActorRecord.ActorName;
		Ar << ActorRecord.ActorData;
		return Ar;
	}
};

In my save function i have this :

void TestSaveFunction()
{
                FActorRecord TestActorRecord;
        	TestActorRecord.ActorClass = TestActor->GetClass();
        	TestActorRecord.ActorTransform = TestActor->GetTransform();
        	TestActorRecord.ActorName = TestActor->GetName();
        	
        	UE_LOG(INU_Log, Warning, TEXT("TestActorRecord.ActorClass = %s"), *TestActorRecord.ActorClass->GetName());
        	UE_LOG(INU_Log, Warning, TEXT("TestActorRecord.ActorName = %s"), *TestActorRecord.ActorName);
        
        	FBufferArchive ToBinary;
        
        	ToBinary << TestActorRecord;
        
        	UE_LOG(INU_Log, Warning, TEXT("ToBinary Length = %d"), ToBinary.Num());
        
        	ToBinary.FlushCache();
        	ToBinary.Empty();
}

Compile did fine. But when i run TestSaveFunction() i have error , where saying about operator<< :

UE4Editor_Core!FDebug::AssertFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\misc\outputdevice.cpp:374]
UE4Editor_OnceInAntarctica!FMemoryArchive::operator<<() [i:\epic games\4.10\engine\source\runtime\core\public\serialization\archive.h:55]

If i comment line : Ar << ActorRecord.ActorClass; then all do work fine. I did check operator<< for TSubclassOf and he already exist . What did i do wrong ?

Have you tried checking out that line in the source to see what it says?

yes , there is this function :

virtual FArchive& operator<<( class UObject*& Res )
{
	// Not supported through this archive
		check(0);
    		return *this;
}

but i do not understand.How i will solve it ?

Problem was solved. I am using FObjectAndNameAsStringProxyArchive instead FArchive