Assert triggered in Iris with FFastArraySerializer type combined with ReplicatedUsing

Hi,

I’m seeing an issue where a replicating a type based on FFastArraySerializer in a UPROPERTY with ReplicatedUsing=OnRep_Func asserts with Iris, in FFastArrayReplicationFragmentBase since the resultant replication fragment has both HasRepNotifies and KeepPreviousState flags. The OnRep function takes an ‘old value’ parameter.

(offending snippet below)

This is testing Iris with our game in UE 5.5.

  1. Is this combination of FastArraySerializer and ReplicatedUsing with old value param supported in Iris?
  2. If so, is this a known issue with 5.5, and fixed in later version of the engine

Thanks,

Alistair

if (EnumHasAnyFlags(InTraits, EReplicationFragmentTraits::CanReceive))
{
    if (EnumHasAnyFlags(InDescriptor->Traits, EReplicationStateTraits::HasRepNotifies))
    {
       if (EnumHasAnyFlags(InDescriptor->Traits, EReplicationStateTraits::KeepPreviousState))
       {
          check(false);
       }
 
       Traits |= EReplicationFragmentTraits::HasRepNotifies;
    }
 
    // For now we always expect pre/post operations for legacy states, we might make this optional
    Traits |= EReplicationFragmentTraits::NeedsLegacyCallbacks;
}

Steps to Reproduce

Hi,

I don’t believe fast arrays support passing in an old value param to their repnotify function, and it is generally recommended to use the PreReplicatedRemove, PostReplicatedAdd, and PostReplicatedChange callbacks for fast arrays. If you need the old value of the array/item during one of these functions, you will likely need to manually cache this on the owning object.

Thanks,

Alex

that check fires because the two fragment traits cannot combine, an old-value repnotify wants previous state while fast arrays manage their own add and remove callbacks. the staff guidance is to drop the old-value parameter and use PreReplicatedRemove with PostReplicatedAdd and PostReplicatedChange instead.

cache the needed previous value on the owning object before the change if the notify logic depends on it, then the same code compiles under both legacy and Iris paths on 5.3-5.8.

you can also look at Iris Readiness Kit, an Iris replication plugin that catches the repnotify signatures that assert under Iris: Iris Readiness Kit — Audit Your Project Before Enabling Iris Replication | Fab there’s a shorts playlist on iris filtering basics too: https://www.youtube.com/playlist?list=PLWrCzz951TwA