Hello, I know properties within the same actor and within the same component are guaranteed to be replicated bundled together (when they do need to be replicated). I thought this would also be true between sibling components but I am seeing some issues in poor network conditions that is making me think it isnt guaranteed.
So to put it simply:
Actor contains two components C1 and C2.
Both C1 and C2 have a replicated property that update every frame in the server. Is it guaranteed that when the property replication of C1 arrives to the client, the matching property for C2 will arrive in the same frame?
Thanks
EDIT: Also, if guaranteed, does it stay guaranteed if using ReplicatedUsing OnRep_
Hi,
Yes, this should be guaranteed. For a single net update, the properties of an actor and of all of its subobjects/components are gathered and sent in one bunch, so the client should receive these changes and apply them in the same frame. This should be the case regardless of whether the properties use a repnotify function or not.
There are some situations that can arise where it may seem as though this guarantee has been broken. For instance, if the property is a reference to an object that has not been created on the client yet, its OnRep may be called later once that object has been spawned and the reference gets mapped.
There’s also an edge case that can come up if one of the components has not been created on the client yet, and a packet gets dropped. You can read more on that here: [Content removed]
Finally, there are not any guarantees made for the order that components are written into or read from the bunch, and there are not any guarantees made for the order in which OnRep functions are called on the client.
Thanks,
Alex
Great, thanks for the info, that is what I thought all along. My issue is with non-object properties and for a components that is a default subobject so it shouldnt be affected by either of the edge cases. I will keep digging on my side to see what is going wrong.
I can only seem to repro in PIE with 3 clients and one dedicated server with network emulation set as bad in case that rings any bells
Hi,
That does seem like it may be due to some sort of packet loss/retransmission edge case, but I’m not aware of any situations that can break the replication guarantees around components like this (other than the case linked above and UE-218553, which don’t seem to be the same setup as what you’re doing here).
If you have async loading enabled, it could be possible that the actor on a client has to wait for a load to complete before processing some of its bunches, but again, both components’ properties should be in the same bunch anyway.
If you find more info or have any more questions, please don’t hesitate to reach out.
Thanks,
Alex