Repository navigation
Conversation
…plied twice Override WriteFieldSynchronization in NetworkList<T> so a client synchronized while local changes are still pending receives the list as of the last sent delta, mirroring NetworkVariable<T>. The pending events are then applied exactly once with the next delta. Fixes #4179
| // receive the list they apply to. Otherwise it would apply them twice. | ||
| if (m_HasLastSentList && m_DirtyEvents.Length > 0) | ||
| { | ||
| WriteList(writer, m_LastSentList); |
There was a problem hiding this comment.
Showing an object while list updates are throttled can leave the new observer permanently missing pending edits. For example, add an item and call NetworkShow before MinSecondsBetweenUpdates expires. ForceSendIfDirtyOnNetworkShow removes the object from the updater even when CanSend() prevents sending or clearing its dirty events. WriteFieldSynchronization then sends m_LastSentList, but subsequent ticks cannot deliver those events unless another mutation requeues the object. Previously, synchronization sent the current list. Keep the object queued when pending events cannot be sent. Add a regression test for throttled updates during NetworkShow.
🤖 Helpful? 👍/👎
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop-2.0.0 #4215 +/- ##
=================================================
+ Coverage 74.20% 74.23% +0.02%
=================================================
Files 172 172
Lines 28200 28258 +58
=================================================
+ Hits 20926 20976 +50
- Misses 7274 7282 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes
|
|
Thanks for taking this over, @EmandM! I looked into the P1 from the harness review and it's valid. Follow-up commit on my fork: quantum-shubham@3df3e551
Tested locally on 6000.0.72f1 (PlayMode, Could you cherry-pick it onto this branch? |
Purpose of this PR
Fixes: #4179
Continues: #4200
If a client is synchronized while a
NetworkList<T>still has unsent changes, the synchronization snapshot already contains those changes. On the next tick the same events are sent to the new observer again. Add, Insert, Remove, RemoveAt and Set are not idempotent, so the late-joining client ends up with duplicate entries, and later index-based events land on the wrong elements. #3081 fixed this forNetworkVariable<T>throughWriteFieldSynchronization, butNetworkList<T>never overrode it.NetworkList<T>now overridesWriteFieldSynchronization, mirroringNetworkVariable<T>. While local changes are pending, it writes the list as it was before the first of them. The pending events then bring the client up to date exactly once with the next delta.Jira ticket
n/a
Changelog
NetworkList<T>still had unsent changes applied those changes twice, resulting in duplicate entries and index-based events landing on the wrong elements on that client.Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?Up-port
Up-ported in #4216
Backports
Not needed.