Description
When using a NetworkList with a custom type (a struct that supports NetworkVariable), the list does not sync with clients.
Reproduce Steps
- Create a struct to be used with the NetworkList, let's call it MyStruct. Make sure it can be used as a NetworkVariable, so it needs to implement INetworkSerializeByMemcpy, IEquatable.
- Have a NetworkBehavior on a prefab that also contains the NetworkObject behavior.
- Use NetworkList in the NetworkBehavior, set it in the Awake call and add some elements to it.
- Instantiate the prefab on the server, and call Spawn on its NetworkObject so that it spawns on the clients as well.
- Notice how NetworkList does not sync on the clients.
Environment
- OS: Win10
- Unity Version: 2022.9
- Netcode Version: 1.0.0-pre.9
Workaround
Once the GameObject has spawned for the clients, if on the server we do NetworkHide then wait a bit (50ms) then do NetworkShow, the NetworkList will now sync properly for the clients.
Description
When using a NetworkList with a custom type (a struct that supports NetworkVariable), the list does not sync with clients.
Reproduce Steps
Environment
Workaround
Once the GameObject has spawned for the clients, if on the server we do NetworkHide then wait a bit (50ms) then do NetworkShow, the NetworkList will now sync properly for the clients.