As title, it seems like for predicted ghost spawns where we set a ghost field to reference the spawned ghost itself does not seem to be covered by the serializer CopyToSnapshot; as it checks the ghostId which cannot have been set yet.
A self reference to a ghost only work in case the ghost you are referencing is one already spawned. For the spawned ghost itself, being not replicated or acknowledge by the server all references are considered invalid. And so the initial content in the snapshot buffer is indeed contain an invalid reference.
That initial snapshot is going to be discarded anyway as soon as the entity is matched by the classifier, so the reference will auto-fix itself. For partial ticks this will still work fine, because the restore just copy component data (not snapshot data). And because no rollback occurs for predicted spawned ghost this work somehow.
But I do agree is not great. Requires some changes in the way we store this reference in this case, so we can play a little “smarter” (by detecting is a self reference or a reference to a predicted spawned ghost). However for cross-entity reference there are still some issue to be solved in case the ghosts are not sent all together.
Thanks for reporting, we will try to fix this behaviour.
I guess this is where it broke for us, since we’ve added support for rollback for predicted spawned ghosts to avoid other issues I’ve posted in other threads^^.
Ah ok, now make sense.