Description
When network visibility of a NetworkObject changes from hidden to visible for a Client and the NetworkObject contains a NetworkList, the list contains duplicate entries when it's synced from Server to Client.
Steps to Reproduce
- Instantiate a
NetworkObject no, set no.CheckObjectVisibility = (clientId) => false, and spawn the NetworkObject (which is now hidden to all Clients).
- On the Server, add an entry in a
NetworkList that's attached to the NetworkObject. Check its contents on the Server.
- Make the
NetworkObject visible to a Client. Check the contents of the NetworkList on the Client. Notice that it contains the added entry in it twice instead of once.
I haven't reproduce this on a small test project and the steps above might not be exactly correct. Try adding/removing items from the NetworkList before and after making the NetworkObject visible to the Client and check if it's synced correctly.
Expected Outcome
NetworkList is always synchronized correctly from Server to Client.
Environment
- OS: Windows 10
- Unity version: 2021.3.19f1
- Netcode version: 1.2.0
Description
When network visibility of a
NetworkObjectchanges from hidden to visible for a Client and theNetworkObjectcontains aNetworkList, the list contains duplicate entries when it's synced from Server to Client.Steps to Reproduce
NetworkObject no, setno.CheckObjectVisibility = (clientId) => false, and spawn theNetworkObject(which is now hidden to all Clients).NetworkListthat's attached to theNetworkObject. Check its contents on the Server.NetworkObjectvisible to a Client. Check the contents of theNetworkListon the Client. Notice that it contains the added entry in it twice instead of once.I haven't reproduce this on a small test project and the steps above might not be exactly correct. Try adding/removing items from the NetworkList before and after making the NetworkObject visible to the Client and check if it's synced correctly.
Expected Outcome
NetworkListis always synchronized correctly from Server to Client.Environment