Hi all!, im working on a multiplayer game and i found a major issue concerning the NetworkViews with multiple clients.
This problem happens on “sandwich”-clients: naming like this at the clients which are not the last connected client.
When a “sandwich” client disconnects and connects again to the server, it won’t receive any data from the newly created NetworkViews on the server.
Also, the reconnected “sandwich” clients won’t receive any data from the previous NetworkViews that were “recreated”: which means destroying the NetworkView and creating it again with the same viewID to solve the “Received state update for view ID AllocatedID: # but no initial state has ever been sent. Ignoring message.” issue. (see http://forum.unity3d.com/viewtopic.php?t=11405)
Only when the clients that had connected after this “sandwich” client disconnects, and the server recreates its NetworkViews, it will start receiving the data from the NetworkViews.
This issue happens with the “stateSynchronization” set to “ReliableDeltaCompressed”.
I’m attaching a small proyect where you can reproduce this issue.
These are the steps to reproduce the bug:
- On computer “A”, click “Start Server”.
- On computer “B”, click “Join Game”.
-
On computer “C”, click “Join Game”.
-
On computer “A” you should see the log of the 2 new connected clients.
-
On computer “A”, press “Add” which will create a new instance of NetTestInstace: this is a component that synchronizes a text through a NetworkView.
-
On computer “A”, add “something” into the TextField that has appeared.
- Notice that the text was synchronized on computers “B” and “C”.
8. On computer “B”, click “Disconnect”.
9. On computer “B”, click “Join Game”.
- On computer “A”, change the “something” text to “still works”.
- Notice that the text was synchronized on “B” and “C”.
- On computer “A”, click “Add”, and on the new TextField enter this: “this wont work on B”.
13. Notice that on computer “B”, the second text was not synchronized, but on computer “C”, it was.
-
On computer “A”, click on thefirst “Recreate NV” button.
-
On computer “A”, change the first TextField from “still works” to “not anymore on B”
- Notice that “B”, was not synchronized and “C” was.
-
On computer “C”, click “Disconnect”.
-
On computer “A”, click both two “Recreate NV” buttons.
-
Notice that “B” is now synchronized.
I cant use Network.Instantiate() on my game because im getting the prefabs from AssetBundles downloaded from the web.
I was not able to find any workaround yet to solve this problem.
I will paste the code here in case someone wants to check it without downloading the project.
Please help!
PS: here’s the link to download the test project
http://www.megaupload.com/?d=C2E4XUH3
Edit: we uploaded the project to http://sandwichbug.1free.ws/ so you can test it.