I have a NetworkList. Which is syncing and working normally across host/clients when updated (value added or removed) while all clients are connected.
OnListChanged is triggered on all clients whenever the NetworkList is updated.
However in this situation:
Host starts game and updates the NetworkList
Client joins late with some latency, for example 200ms (after NetworkList already has values)
Clients initially has an empty NetworkList on connect, and when it does get the initial sync update it does not trigger the OnListChanged
So how can I determine when the client has received the initial sync values? The only way I can think of is to have a hackish timer that keeps checking the network value manually.
I think I’ve found the issue that I was binding the OnListChanged listeners within the Start method, if I move binding the listeners into the OnNetworkSpawn method it seems to solve the issue.
OnNetworkSpawn does seem to best place to register OnListChanged and OnValueChanged callbacks. There have been issues with network lists not correctly syncing with clients on spawn, and there’s an outstanding issue where a network list can be sent twice by the server, once on spawn and then as OnListChanged events leading to the client list having double the content it should have.
Oh? Any recollection on where this issue is listed? I’ve been fighting with the NetworkList for most of a day now and the damned thing seems to spoof some magical entries into it, only present clients are Host+Client and each adds itself to the list via a ServerRpc in OnNetworkSpawn and the end result is that the Host has a correct list (two elements with correct data) while the Client has three entries, one for the Host and two for the Client. Meaning the list is not synchronized or reliable in any meaningful manner.
If you’re on the latest version of Netcode and are seeing this you might want to create a new issue for it.
Oh I remember a little more now the network list was being re-sent when I changed a network variable value in the same object, very bizarre behaviour and I’m not sure it’s related.