Description

This seems to be caused by the following:

  • The struct, which has an actor reference property as well as some other properties, implements its own NetSerialize function.
  • When the actor reference property is set, ReceivePropertyHelper in RepLayout adds a new entry to the GuidReferencesMap. Because the struct has a native NetSerialize function, any properties serialized in this function will also be included in this entry, not just the actor reference property.
  • Later, the actor goes out and then back into relevancy, causing FRepLayout::UpdateUnmappedObjects_r to detect that an unmapped GUID has been mapped.
  • When this happens, a FNetBitReader is initialized using the buffer from the entry in the GuidReferencesMap.
  • The new value for the actor reference property is then read using this Reader, by calling the struct's NetSerialize. This results in the other properties' old values (at the time the reference was initially set) being read and applied as well.
  • When the replicator then calls the RepNotifies after updating the unmapped objects, the struct's OnRep will be called with the mapped reference as well as the old values for the struct's other properties.
Steps to Reproduce

Create a struct with a custom NetSerialize function, which serializes at least an actor reference property as well as some other property, such as an int counter. Implement an OnRep function for this struct.

As the counter goes up, set the actor reference property (note the value of the counter).

Have the referenced actor go out of relevancy, then become relevant again.

Expected: the OnRep will be called for the struct, with the now mapped reference as well as the current value for the counter.

Actual: the OnRep will be called with the mapped reference, but the counter will be set to the value it was equal to when the reference was first set.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-183263 in the post.

1
Login to Vote

Fixed
ComponentUE - Networking
Affects Versions5.2
Target Fix5.3
Fix Commit25041723
Main Commit25041723
CreatedApr 13, 2023
ResolvedApr 14, 2023
UpdatedMay 15, 2023
View Jira Issue