Closed philpax closed 1 month ago
I haven't followed to closely all the logs, but it sounds like you want to guarantee that A is received before B? Is it ok if A and B are replicated together?
You can use ReplicationGroups to guarantee that multiple entities will be part of the same packet. You just need to give the same ReplicationGroupId to both entities
Oh, I didn't realise that would work - my use case was attaching OwnedByPlayer
to client-replicated entities so that clients could join other-clients'-owned-entities to their player entity, and I assumed that ReplicationGroup
wouldn't work for that due to timing. Seems to work on LAN, so I'll close this unless I encounter this on a real network - thanks again for the guidance :pray:
If you have two entities, A and B, where B contains a component with
add_map_entities
pointing to A, and B is received before A, the ID that B contains of A will be the server's ID and not the mapped ID.The following systems on the server (simplified):
and on the client:
with this component registration (apologies, macro-generated code):
produce the following logs (trimmed):
That is, the Test entities with the
OwnedByPlayer
component that are received the same, or previous tick, to the actual player entity receive the server's entity ID. Delaying the spawn so that the player entities have definitely been replicated to the client results in the ref being resolved correctly.I'm not sure what the correct fix would be here - delaying the addition of the component until a mapping can be established, perhaps?
(Same behaviour with #656 as well)