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

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss