#Scene Sync Issues

1 messages · Page 1 of 1 (latest)

regal belfry
#

So I was debugging, and when I print out the

NetworkManager.Singleton.SceneManager.ActiveSceneSynchronizationEnabled

it reads as false on the client, even though I set it to true on the Host

#

code:

    public async void StartHost(int _maxMembers)
    {
        NetworkManager.Singleton.OnServerStarted += Singleton_OnServerStarted;
        NetworkManager.Singleton.StartHost();
        GameManager.Instance.myClientId = NetworkManager.Singleton.LocalClientId;
        currentLobby = await SteamMatchmaking.CreateLobbyAsync(_maxMembers);

        // Make sure players who join late sync their scenes with the host
        NetworkManager.Singleton.SceneManager.ActiveSceneSynchronizationEnabled = true;
    }

somber pond
#

I have the same problem right now.

private void LoadGameScene()
{
    this._loadingScreen.SetActive(true);
    this._lobbyController._stop = true;
    if (NetworkManager.Singleton.IsHost)
    {
        NetworkManager.Singleton.SceneManager.ActiveSceneSynchronizationEnabled = true;
        NetworkManager.Singleton.SceneManager.SetClientSynchronizationMode(LoadSceneMode.Single);
        NetworkManager.Singleton.SceneManager.LoadScene(this._gameSceneName, LoadSceneMode.Single);
    }
}

Im stuck in this for the past few days but I dont find any tutorial or documentation online on how to load / unload scenes. Even the documentation of the NetworkManager.SceneManager doesent help.

#

@regal belfry did you find a way?

regal belfry
#

Hey! My problem was that I had too many network objects on my player prefab and it was having a problem with it. It also had unnecessary things in my default prefab list, so I got rid of those too. Make sure that your network manager has auto scene migration checked as well. You can log that value out on runtime to help check it if you need to

somber pond
#

And I only have one NetworkObject and that is the player.

#

The host connects and changes the scene. Just the clients dont change the scene but still connect.

regal belfry
#

Did your host change the scene before the clients connect? Or are you changing the scene with your clients already connected? Or are you chaning the scene and connecting clients at the same time?

somber pond
regal belfry
# somber pond I load the scene before the clients connect.

Then I would double check that all necessary scene objects are spawned in correctly, that they're all in the networked prefabs list, and all have network objects on them correctly. That is what solved my issue. I had network objects on some UI elements (which are attached to the player) and it didn't like it.

somber pond
regal belfry
#

An empty scene? How are you spawning in your players then?

somber pond
#

Right now I use the player prefabs for prototyping. But the scene doesn't load on the client.

#

I wa t to load the maps etc. In additive mode inside the game scene