TArray::BulkSerialize

Bulk serialize array as a single memory blob when loading.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Containers/Array.h

Include

#include "Containers/Array.h"

Syntax

void BulkSerialize
(
    FArchive & Ar,
    bool bForcePerElementSerialization
)

Remarks

Bulk serialize array as a single memory blob when loading. Uses regular serialization code for saving and doesn't serialize at all otherwise (e.g. transient, garbage collection, ...).

Requirements:

  • T's << operator needs to serialize ALL member variables in the SAME order they are layed out in memory.

  • T's << operator can NOT perform any fixup operations. This limitation can be lifted by manually copying the code after the BulkSerialize call.

  • T can NOT contain any member variables requiring constructor calls or pointers

  • sizeof(ElementType) must be equal to the sum of sizes of it's member variables.

  • e.g. use pragma pack (push,1)/ (pop) to ensure alignment

  • match up uint8/ WORDs so everything always end up being properly aligned

  • Code can not rely on serialization of T if neither IsLoading() nor IsSaving() is true.

  • Can only be called platforms that either have the same endianness as the one the content was saved with or had the endian conversion occur in a cooking process like e.g. for consoles.

Notes:

  • it is safe to call BulkSerialize on TTransArrays

IMPORTANT:

  • This is Overridden in XeD3dResourceArray.h Please make certain changes are propogated accordingly

Parameters

Parameter

Description

Ar

FArchive to bulk serialize this TArray to/from

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback