unity networking: delaying network instantiation until level is loaded

Hi,

I am working on a networked multiplayer game that has multiple scenes that players will move through as they play the game. The game works well in both single and multiplayer mode so a player can choose to host a game and then play through a level while waiting for another player. I am trying to make it so that players can join a network game no matter what scene the server player is currently on.

Right now I am able to get the correct level to load by having an object that persists through the scenes that controls what level the players are on by sending buffered RPC calls to a function that changes the level. Unfortunately when the client player gets the proper level loaded none of the network instantiated game objects are there.

This is because the objects are being instantiated on the start scene before the proper scene gets loaded. So the client loads the default start scene, the game objects are networked instantiated, then the client is taken to the proper scene the host is on but everything networked instantiated is lost in the scene change.

Is there a way I can make the game delay running the network instantiate calls until after the game is in the correct scene?

Thanks,

-Jake

There is:

Network.isMessageQueueRunning can be set to false to stop buffered RPCs from executing (and Network.Instantiate is a buffered RPC). You can then turn it back on once your level is loaded.

You may also need to clean your RPC buffer when your server loads a new level to avoid having elements from old scenes loaded into your clients at startup.