Scenes with netcode in single mode are not reloaded on late connected clients

I'm trying to build up the basic functionality of a multiplayer game with netcode.
However, I still have problems with netcode and understand it properly.

I would like to go directly "in-game" as a host and if a client joins/connects later,
should this also come directly in-game.

Since Netcode takes over the scene management for me, this should be possible via
NetworkManager.SceneManager.LoadScene. Here is a minimal example:

    public void StartGameAsHost(string profileId)
    {
        NetworkManager.Singleton.StartHost();

        if (IsServer)
        {
            NetworkManager.SceneManager.LoadScene("TestMap01", LoadSceneMode.Additive);
        }

    }

    public void JoinGameAsClient(string profileId)
    {
        NetworkManager.Singleton.StartClient();
    }

That works. But only as long as I selected LoadSceneMode.Additive. The client then builds exactly the same scenes. However, if I switch to LoadSceneMode.Single, nothing seems to change on the client after the connect, i.e. no scene is loaded.

My second problem is that I would like to load multiple Additive Scenes, but unlike the local one, I can only load one at a time. Is it not possible to load multiple complementary scenes via network?

    NetworkManager.SceneManager.LoadScene("TestMap01", LoadSceneMode.Additive); 
    NetworkManager.SceneManager.LoadScene("Gameplay", LoadSceneMode.Additive);

What can be the reason? Maybe someone can help me?

Okay, I found out that using single does work. Nothing was displayed visibly, because the complete replacement of a scene logically deletes all non-DDoL GameObjects on both the server and client side, which in my case meant that there was no camera in the new scene.:face_with_spiral_eyes:

However, my second problem with the multiple additive scenes remains

Generally speaking it is best to not do anything straight after calling StartHost/Server but rather delay anything (ie load scene) to the usual callback event such as client connected or OnNetworkSpawn.

Similarly I can imagine (just a hunch) that you cannot issue multiple additive scene loads right after another. Instead wait for the „scene was loaded“ callback and then load another scene additively.

1 Like