- Home /
Multiplayer Level Loading
In this example on the Unity documentation it explains that the sending of RPCs should be turned off while the server loads
Network.isMessageQueueRunning = false;
Network.SetSendingEnabled(0, true);
This works awesome for my server, however I am getting the following error on my clients joining the server
View ID SceneID: 9 Level Prefix: 1 not found during lookup. Strange behaviour may occur
Do I need to set Network.SetReceivingEnabled to false on clients during their loading, but not on the server?
Basically, does the server change Sending to false and client ALSO change receiving to false during client loading for it to work?
The way I understand that example is that the server calls:
networkView.RPC( "LoadLevel", RPC$$anonymous$$ode.AllBuffered, level, lastLevelPrefix + 1);
And this call is sent to all connected clients including the server itself. So all clients (and the server) execute the LoadLevel() function, which in turn disables sending and receiving messages for everyone until the
Application.LoadLevel(level);
call has finished and sending & receiving messages is enabled again.
Network.SetLevelPrefix(levelPrefix);
Is also called on all connected clients (including server) to make sure that all new network views will have different IDs than the ones in the previous level.
After that all local gameobjects are alerted that a new level has finished loading.
I understand that but I am running a join in progress game so not all players are loading the map at the same time. A person may join at 10 $$anonymous$$ in.
You might want to have a look at Buffered RPC calls for that. Here's a list of the possible RPC$$anonymous$$odes when sending a Remote Procedural Call.
This topic unfortunately isn't as simple as setting is$$anonymous$$essageQueueRunning to false.. Here's a forum post on the matter that might help a little, but other than that it's essentially about making sure the players who join the game later receive all the necessary RPCs to be able to recreate the same state as the other clients (e.g. remembering which GOs were instantiated).
The error you received was caused by the fact that your scene didn't have a network view with an ID of 9 in the scene (most likely this GO was instantiated before the other player connected).
I already know all the buffered RPC modes. I have read through that forum post for the past week. Which is still not helping me. The only objects that have been instantiated were created with Network.instantiate which i thought were buffered RPC's. Actually, I just realized, there is one object that I haven't instantiated with Network.instantiate. I'll check that now.
Answer by MiniForge · Jan 11, 2015 at 02:06 AM
To solve the issue I needed my isMessageQueueRunning and isMessageQueue inside my level loading coroutine, not after it.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Animation over network using rpcs 0 Answers
How to use an RPC to send an animation over the network? 2 Answers
[Error] RPC function undefined in IRRELEVANT file? 0 Answers