Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

FBufferArchive and operator<<

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

 struct FActorRecord
         TSubclassOf<AActor> ActorClass;
         FTransform ActorTransform;
         FString  ActorName;
         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());

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 ?

Product Version: UE 4.10
more ▼

asked Jan 16 '16 at 12:21 PM in C++ Programming

avatar image

1 1 2 2

avatar image TTaM Jan 16 '16 at 05:03 PM

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

avatar image InuHitman Jan 16 '16 at 06:48 PM

yes , there is this function :

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


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

avatar image InuHitman Jan 17 '16 at 07:37 PM

Problem was solved. I am using FObjectAndNameAsStringProxyArchive instead FArchive

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question