- Home /
May different clients on the network load different scenes?
I have a server and a client connected to each other like in the networking example. When the game is over the winner loads the "winning scene" and tells the loser to load the "losing scene" via RPC. At this point the server crashes.
My question is - does Unity3D assume that both instances of the game always load the same scene? I am using the LoadLevel method from the networking example.
It is technically possible to load different scenes like this, but you have to be really careful that you take care of all the networkViewIDs. Every networkView must have a corresponding networkView on every other networked computer, otherwise the errors start to pile up. It is possible, by the way, to have a networkViewID which refers to a completely different script on either side- but you have to be very careful that you name all your RPC calls properly, and serialize/deserialize your data correctly.
That must be the cause. I have managed to avoid the crash and see some errors get logged.
"Received state update for view id' AllocatedID: 51' but the NetworkView doesn't exist"
Apparently the "NetworkRigidbody" script of the enemy bullet that has just killed me manages to sneak one last serialization call before receiving the GameOver message. Its non-existing counterpart receives a deserialization call after the game has resumed receiving messages again. This happens when the new scene has been fully loaded... I'll figure it out, eventually.
Answer by DaveA · Nov 16, 2011 at 12:29 AM
It may be easier to have a 'closing scene' which can display either message, and tell each client which to show, which to hide.
Well, the point of having two different scenes is that there is absolutely nothing to synchronize between them. :)
I tried using a single empty scene and the problem remained. I think the removed entities cause it, not the new scene(s). Unity complains about receiving an update from the dead entities after the new scene have been loaded successfully.
Your answer
Follow this Question
Related Questions
Is there a way to create a shared variable between all the clients over network? 1 Answer
How to sync a ball, where two players kick it in turns? (Multiplayer game using UNET) 0 Answers
Question about RPCs 1 Answer
Unity Networking synchronize 3DText's 1 Answer
Check if RPC was received or acknowledged by the client 1 Answer