# How to assign FArchive and FMemoryReader to a file properly?

**URL:** <https://forums.unrealengine.com/t/how-to-assign-farchive-and-fmemoryreader-to-a-file-properly/2158455>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [November 29, 2024, 5:50pm UTC](https://forums.unrealengine.com/t/how-to-assign-farchive-and-fmemoryreader-to-a-file-properly/2158455 "2024-11-29T17:50:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![playwithmewerder](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/playwithmewerder/32/971685_2.png) [@playwithmewerder](https://forums.unrealengine.com/u/playwithmewerder)\
**Post date:** [November 29, 2024, 5:50pm UTC](https://forums.unrealengine.com/t/how-to-assign-farchive-and-fmemoryreader-to-a-file-properly/2158455/1 "2024-11-29T17:50:19Z")

</div>

Here is my code. Either load or save doesnt work properly. I dont know where exactly the issue is.

SAVE:

```
	FArchive* FileWriter = IFileManager::Get().CreateFileWriter(*FilePath);

	// Serialize the data chunk to the file
	ChunkToSerialize->Serialize(*FileWriter);

```

LOAD:

```
	TArray<uint8> FileData;
	FFileHelper::LoadFileToArray(FileData, *NavDataPath);
	FMemoryReader NavDataReader(FileData, true);

	DataHolderChunk->Serialize(NavDataReader);

```

---

<div class="post-metadata">

**Author:** ![silnarm](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/silnarm/32/955303_2.png) [@silnarm](https://forums.unrealengine.com/u/silnarm)\
**Post date:** [November 29, 2024, 8:32pm UTC](https://forums.unrealengine.com/t/how-to-assign-farchive-and-fmemoryreader-to-a-file-properly/2158455/2 "2024-11-29T20:32:59Z")

</div>

Possibly relevant thread/answer: [How do you serialize and deserialize a UObject to/from an FArchive file? - #6 by zos](https://forums.unrealengine.com/t/how-do-you-serialize-and-deserialize-a-uobject-to-from-an-farchive-file/563740/6)

Looks wrong to me, property names and types shouldn’t serialised… I guess it (potentially) solves versioning issues, but you are going to get very bloaty files. If this is the way UObjects serialise by default, I think you may want to write your own serialisation code.
