Skip to main content

Fast Array Internals

FRepInventoryData derives from FFastArraySerializerItem. FInventoryList derives from FFastArraySerializer and declares WithNetDeltaSerializer through TStructOpsTypeTraits. NetDeltaSerialize passes Entries to FastArrayDeltaSerialize.

Active Native Helpers​

HelperBehavior
AddToArrayCreates entry, clamps initial stack to InMaxStackSize, outputs overflow, marks item and array dirty
RemoveFromArrayFinds GUID, removes entry and marks array dirty
AddToStackFills up to stored maximum, outputs overflow and marks changed item dirty
RemoveFromStackSubtracts and clamps to zero, reports whether empty and marks item dirty
FindNonFullStackLinear search for a matching ItemID with spare stored stack capacity

These are native helpers, not exposed Blueprint operation nodes. The large commented legacy block in InventoryStructs.cpp is not an active sorting/compaction API. Array mutations must preserve dirty marking; editing Entries or StackSize directly bypasses that machinery.

AddToArray accepts a caller-provided valid GUID but does not reject duplicate GUIDs or a None ItemID. The normal component add path creates GUIDs with FGuid::NewGuid. Custom callers must enforce uniqueness and registered IDs.


Receive Notifications​

Entry PostReplicatedAdd invokes I_FastArrayListener::OnSlotAdded; PostReplicatedChange invokes OnSlotUpdated. List PreReplicatedRemove invokes OnSlotRemoved while the removed entry can still be read. This is the removal route used for GUID-based widget cleanup.

List PostReplicatedAdd/Change report array-level notifications. The source also declares PostReplicatedRemove functions, but these declarations alone do not establish an engine-supported post-remove hook; rely on the implemented PreReplicatedRemove route and verify event behavior in Unreal. Do not depend on OnInventoryEntryRemoved as the sole removal signal.

The component converts listener calls to Blueprint delegates. Native server helpers only mark state dirty; they do not invoke those same slot listeners locally. Owner is assigned in BeginPlay; receive paths that dereference it must be tested against initialization timing.