com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

NetworkList behaviour on object spawn.

Open ezoray opened this issue 3 years ago • 1 comments

I'm making a lot of use of NetworkLists in my network objects and I wanted to check if this is intended behaviour.

I have a network object which contains a network list of structs, I populate the list with initial values and then the object is spawned, hidden from the client. Later I show the object to spawn it on the client, if I then directly afterwards (in the same frame) make changes to the contents of the network list, on the client side OnNetworkSpawn does not have the updated list, nor is OnListChanged triggered. If I want to have the correct up-to-date list I have to wait until Start.

Is this the correct behaviour?

Incidentally I was wondering if OnListChanged should be called on object spawn in the same way OnValueChanged is for network variables.

ezoray avatar Aug 04 '22 14:08 ezoray

Actually using Start is unreliable, the list is sometimes but not always up-to-date when it's called leading to list changes being missed.

I'd change this issue to being a bug can't see how to change the label.

ezoray avatar Aug 04 '22 16:08 ezoray

I'll close this as using the latest develop update it appears to have been fixed.

ezoray avatar Aug 25 '22 14:08 ezoray