UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FStructScriptLoader Class Reference

#include <StructScriptLoader.h>

+ Inheritance diagram for FStructScriptLoader:

Public Member Functions

 FStructScriptLoader (UStruct *TargetScriptContainer, FArchive &Loader)
 
bool IsPrimed ()
 
bool LoadStructWithScript (UStruct *DestScriptContainer, FArchive &Loader, bool bAllowDeferredSerialization=true)
 

Static Public Member Functions

static bool ShouldDeferScriptSerialization (FArchive &Ar)
 
static int32 ResolveDeferredScriptLoads (FLinkerLoad *Linker)
 

Detailed Description

Utility class to aid in struct (UFunction) script serialization. Will defer or skip script loading (if deemed necessary).

Constructor & Destructor Documentation

◆ FStructScriptLoader()

FStructScriptLoader::FStructScriptLoader ( UStruct TargetScriptContainer,
FArchive Loader 
)

Caches data regarding the script's serialized form (archiver offset, serialized size, etc.), so that given the same archiver later (in LoadStructWithScript) it can seek and serialize the target's bytecode.

NOTE: This expects that the supplied archiver is already positioned to read the start of the script's "header" (the script's BytecodeBufferSize).

Parameters
TargetScriptContainerThe target struct (will have its current script cleared).
LoaderThe archiver that holds serialized script data (expected to be seeked to the proper place).

Member Function Documentation

◆ IsPrimed()

bool FStructScriptLoader::IsPrimed ( )

Checks to see if this was created from a valid archiver with script code to serialize in.

Returns
True if the cached serialization info is valid, otherwise false.

◆ LoadStructWithScript()

bool FStructScriptLoader::LoadStructWithScript ( UStruct DestScriptContainer,
FArchive Loader,
bool  bAllowDeferredSerialization = true 
)

Attempts to load the specified target struct with bytecode contained in the supplied archiver (expects the archiver to be the same one that this was created from).

NOTE: Serialization could be skipped if: 1) this isn't properly "primed", 2) we've opted to skip bytecode serialization (for editor builds), or 3) the Loader wishes to have dependency link points deferred (unless bAllowDeferredSerialization is set false)

Parameters
DestScriptContainerThe target struct that you want script code loaded in to.
LoaderThe archiver that holds the serialized script code meant for the target.
bAllowDeferredSerializationIf false, then serialization will be forced through regardless of ShouldDeferScriptSerialization().
Returns

◆ ResolveDeferredScriptLoads()

int32 FStructScriptLoader::ResolveDeferredScriptLoads ( FLinkerLoad Linker)
static

Looks for any struct scripts that were deferred as part of a LoadStructWithScript() call, and attempts to serialize the original targets with the deferred load.

Parameters
LinkerThe linker/archiver that the structs were originally meant to be loaded by.
Returns
The number of structs that were loaded with new bytecode.

◆ ShouldDeferScriptSerialization()

bool FStructScriptLoader::ShouldDeferScriptSerialization ( FArchive Ar)
static

Can be used to determine if the specified archiver wants possible dependency load points (such as bytecode) deferred (until after class serialization).

Parameters
ArThe archiver to check.
Returns
True if the specified archiver has LOAD_DeferDependencyLoads set, otherwise false.

The documentation for this class was generated from the following files: