cBournhonesque/lightyear

Change detection/replication doesn't work on replication-group children

Opened this issue · 2 comments

Initially I had a PlayerText(String) component on my PlayerBundle.
I set a timer for 5 seconds that changes PlayerText, and on the client I listen for Changed<PlayerText> and updated the text. This worked fine.
But now I wanted to make this a separate bundle, PlayerTextBundle. I still see the timer completes, but the client no longer receives the changed value.

Here's a sample project:
https://github.com/treytencarey/placeholder_interest_group_management

  • Start the server and client. Notice the client has text "Server should change this..." (comes from protocol.rs)
  • After 5 seconds, notice the server says "Timer complete". The code updates the PlayerText. (comes from server.rs)
  • Notice the client never receives Changed. (in client.rs)
  • I have verified that without using groups, change detection/replication works as expected.

That's pretty surprising; so you're saying that normal replication (even without interest management) is broken when using replication groups?

Yes. After some further investigation, if I have a PlayerText component string

#[derive(Component, Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct PlayerText(pub String);

On my parent (PlayerBundle), the client picks up the changes when my server sets a different PlayerText value.
On my child (PlayerTextBundle), the client won't get the change.

Here's an example of the replication working, where I put PlayerText on both the PlayerBundle and PlayerTextBundle -- the client picks up the changes as I'd expect.
https://github.com/treytencarey/placeholder_interest_group_management/pull/1/files
But if I just want the PlayerText on the PlayerTextBundle (remove from PlayerBundle) replication of the PlayerText value stops working.

Hopefully this clarifies the issue a bit better