Hello! I’ve been running into an odd bug with the previous value of the OnRep function parameter.
I have a struct that inherits FFastArraySerializer that I have replicated to owners in an Actor Component. The actual replication works perfectly fine, and clients get all changes to said replicated array. The issue is that I have a const reference of the same type in my OnRep parameter in order to get the previous value of the array. This parameter is always empty on clients.
![]()
^ This is what the server sees when modifying the value of the array, and calling OnRep. This is getting called manually since OnRep doesn’t automatically get called in C++.
When the client receives the change, and is called via the CallRepNotifies function, the PreviousResources parameter is empty.

The actual array replicates the changes fine, but that empty fast array is causing issues.
This doesn’t seem to be an issue with standard array replication. I modified my code to use a regular TArray and the previous value worked fine. Here is a screenshot of the client’s OnRep callback, and you can see it isn’t empty.

I haven’t done Fast Array Serialization before, so I’m not sure if there is something I’m missing to get this working. Below is the code of my fast array struct
USTRUCT()
struct FResourceData : public FFastArraySerializerItem
{
GENERATED_BODY()
UPROPERTY()
FGameplayTag ResourceTag;
UPROPERTY()
int ResourceCount;
void PreReplicatedRemove(const struct FResources& InArraySerializer) {}
void PostReplicatedAdd(const struct FResources& InArraySerializer) {}
void PostReplicatedChange(const struct FResources& InArraySerializer) {}
};
USTRUCT()
struct FResources : public FFastArraySerializer
{
GENERATED_BODY()
void AddResource(const FGameplayTag& Tag, const int Count);
bool ConsumeResource(const FGameplayTag& Tag, const int Count);
void ClearResources();
int GetResourceCount(const FGameplayTag& Tag) const;
int GetResourcesNum() const { return Resources.Num(); }
FResourceData& GetResourceAt(const int Index) { return Resources[Index]; }
protected:
UPROPERTY()
TArray<FResourceData> Resources;
public:
bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
{
return FFastArraySerializer::FastArrayDeltaSerialize<FResourceData, FResources>(Resources, DeltaParms, *this);
}
};
/** Specified to allow fast TArray replication */
template<>
struct TStructOpsTypeTraits<FResources> : public TStructOpsTypeTraitsBase2<FResources>
{
enum
{
WithNetDeltaSerializer = true,
};
};
This is the member variables and functions I have in my actor component
UPROPERTY(ReplicatedUsing=OnRep_Resources)
FResources Resources;
UFUNCTION()
void OnRep_Resources(const FResources& PreviousResources);
//GetLifetimeReplicatedProps
DOREPLIFETIME_CONDITION(ThisClass, Resources, COND_OwnerOnly);
Thanks for taking the time to read my post!