UNET: NetworkServer.SpawnObjects() does not spawn objects loaded from Application.LoadLevelAdditiveAsync

Our game loads every scene asynchonously now. I have some objects that have the NetworkIdentity component on them, and they are placed in a scene that I load with Application.LoadLevelAdditiveAsync. After the loading is complete on both the server and the client, I call NetworkServer.SpawnObjects() on the server. However, that does not enable these objects on the client.

Am I doing something wrong? Or was it supposed to work?

this is currently not supported. it is on the roadmap though.

It’s quite an old question, but it’s still one of the top ranked on google, when searching for Async loading in Multiplayer games. Also I did not test it with LoadLevelAdditiveAsync since seanr said that it’s not working.

First you want to start loading on all clients, so you need an Rpc which in return calls something like this:

  //use this to track the progress of your loading
  public AsyncOperation async{ get; private set; }

  IEnumerator StartLoadingAsync ()
    	{
                    // Start the async loading process
    		async = SceneManager.LoadSceneAsync ("MyLevel");
                    // make sure the scene won't be changed before you tell it to
    		async.allowSceneActivation = false;
    
    		//this waits until async is completely done    
    		yield return async;
    
    		Debug.Log ("Waiting for Async Loading is Done");
    
    		async = null;
    
    		// the Tell Server that the client finished loading
                   Cmd_IamReady(myNetworkIdentity);
    	}

async.progress will stop at 0.9, until you set async.allowSceneActivation = true, so once you reach that point, let the server know.
Once all clients are at 0.9, you have to

  1. Send an Rpc that sets async.allowSceneActivation = true

  2. NetworkServer.SetAllClientsNotReady ()

SetAllClientsNotReady will deactivate that clients receive RPCs, so make sure all important information are sent before that.
Your StartLoadingAsync function will now go to its end, where you want to tell the server that you are ready via Cmd_IamReady. This function should call NetworkServer.SetClientReady (clientNetworkIdentity.connectionToClient); on the server.

Once all your clients are ready, call NetworkServer.SpawnObjects() on the server.