So I have a scene in my game that has a few GameObjects with NetworkViews attached to them. These networkviews are set to Unreliable Data, and are targeting a script on the object. However when playing with other people online I have noticed that if I am connected to the game in the lobby, then the host starts the game and we both load the scene, these NetworkViews in the scene appear to never get any OnSerializeNetworkView updates from the server. On the other hand if I join a game that is already in this scene and not in the lobby, the updates come through.
I am completely unable to reproduce when testing locally, even if I inject lag into my computer running the Unity Editor, but this happens consistently online when playing with other people. What could be the cause of NetworkViews not receiving updates?
(Note: I am not receiving any of the error that you would normally get that say “Allocated View ID ## not found” when an update is sent to ViewID on the client that doesnt exist.)
only the creator of the network view can send updates through OnSerializeNetworkView so check where you create it in detail and thats this is the place where you want to write changes
These networkviews are in the scene that is being loaded, not being created at runtime. The server should be writing to the OnSerializeNetworkView and is to clients who connect once the scene has already been loaded on the server.
You should attach the script that contains OnSerializeNetworkView function to related GameObjects networkview
I’m afraid I have made this problem seem much more simple than it really is. I, to a large extent, fully understand Unity Networking and this is plaguing my already released multiplayer game which for the most part has very few other bugs in it.
The issue here is that these objects that are networked are placed in the scene and not added at runtime. When a server device launches the game from a lobby that I have created and other players are also in the lobby, in some cases (I have yet to figure out how to recreate this in a LAN environment even by messing with ipfw on my editor machine) these scene objects will not update, HOWEVER when the game is already launched and someone else joins an in progress game the scene objects always update. The really strange part however is that no error messages are received about not having a view with ## ViewID exists, like you would normally get in a case like this.
I should also point out that on the server device “OnSerializeNetworkView” is always firing even if the client appears to not be receiving the updates from it.