[SceneEventData- Scene Handle Mismatch] - This warning always displays for clients

Thanks for looking!

In a simple two scene setup, and this code on the server/host:

NetworkManager.Singleton.StartHost();
        int i = 0;
        while (i < 10000)
        {
            if (NetworkManager.Singleton.IsListening)
            {
                //NetworkManager.SceneManager.LoadScene("WorldMultiDemo", LoadSceneMode.Single); //This produces same warning
                NetworkManager.Singleton.SceneManager.LoadScene("Scene2", LoadSceneMode.Single);
                Debug.Log($"NetworkManagerIsListening after i={i}");
                return;
            }
            i++;
        }

It always seems to be listening at i=0. The scene loads fine for the host. The client connects with:

NetworkManager.Singleton.GetComponent<UNetTransport>().ConnectAddress = "192.168.xxx.xxx";
NetworkManager.Singleton.StartClient();

The client connects and this warning is created. The documentation here (Using NetworkSceneManager | Unity Multiplayer Networking) says the client should automatically sync, and that looks like it’s happening.

[SceneEventData- Scene Handle Mismatch] serverSceneHandle could not be found in ServerSceneHandleToClientSceneHandle. Using the currently active scene.
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.NetworkSceneManager:SetTheSceneBeingSynchronized (int) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/NetworkSceneManager.cs:738)
Unity.Netcode.SceneEventData:SynchronizeSceneNetworkObjects (Unity.Netcode.NetworkManager) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/SceneEventData.cs:725)
Unity.Netcode.NetworkSceneManager:HandleClientSceneEvent (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/NetworkSceneManager.cs:1788)
Unity.Netcode.NetworkSceneManager:ClientLoadedSynchronization (uint) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/NetworkSceneManager.cs:1754)
Unity.Netcode.ISceneManagerHandler/SceneEventAction:Invoke () (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/ISceneManagerHandler.cs:26)
Unity.Netcode.NetworkSceneManager/DefaultSceneManagerHandler/<>c__DisplayClass0_0:b__0 (UnityEngine.AsyncOperation) (at Library/PackageCache/com.unity.netcode.gameobjects@1.0.0/Runtime/SceneManagement/NetworkSceneManager.cs:344)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()

A search on the forums and google comes up dry for specifics.
Is there something I’m missing here?

Make sure host and client are running the same build, and that “Scene 2” is included in the Build Settings.

Best way to ensure that is to use ParrelSync so you can work with two or more (readonly) Unity editor instances of the same project which is synchronized with the original (editable) project.

This actually hurts my brain:

        while (i < 10000)
        {
            if (NetworkManager.Singleton.IsListening)
            {
                return;
            }
            i++;
        }

I don’t know why you’re doing that, but it’s pointless. The i will either always be 0 or 10000, never anything in-between because this is neither multithreaded nor a coroutine that yields.

1 Like

I get this error on a test project, I’ve never looked into it as it hasn’t caused any issues. Here’s what the comments say in the source code:

// This could be the scenario where NetworkManager.DontDestroy is false and we are creating the first NetworkObject (client side) to be in the DontDestroyOnLoad scene
// Otherwise, this is some other specific scenario that we might not be handling currently.

IsListening is set to true in StartHost so there’s no need to wait on it.

Good to know! I read in the docs that the network manager needed to be completely started before accessing the NetworkSceneManager and I wanted to rule out that causing this issue.

I love ParrelSync! I used it all the time before I started this VR project. I think its great but I’m pretty sure there are some compatibility issues with one of the Oculus SDKs - specifically the OculusAudoSpacializer. Even reverting to previous working commits wouldn’t fix the issue but it hasn’t happened since I stopped using ParrelSync.

// This could be the scenario where NetworkManager.DontDestroy is false and we are creating the first NetworkObject (client side) to be in the DontDestroyOnLoad scene
// Otherwise, this is some other specific scenario that we might not be handling currently.

In my case, one computer is running the build and the other is using play mode in the editor (this warning happens regardless of which is host/client). Perhaps that’s the cause.

Thanks for the replies!