diff --git a/Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs b/Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs index 85af84629..d32ede252 100644 --- a/Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs +++ b/Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs @@ -63,18 +63,21 @@ private void OnConnectFinished(ConnectStatus status) private void OnDisconnectOrTimeout(ulong clientID) { - //On a client disconnect we want to take them back to the main menu. - //We have to check here in SceneManager if our active scene is the main menu, as if it is, it means we timed out rather than a raw disconnect; - if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "MainMenu") + if(clientID == MLAPI.NetworkManager.Singleton.LocalClientId ) { - // we're not at the main menu, so we obviously had a connection before... thus, we aren't in a timeout scenario. - // Just shut down networking and switch back to main menu. - MLAPI.NetworkManager.Singleton.Shutdown(); - SceneManager.LoadScene("MainMenu"); - } - else - { - NetworkTimedOut?.Invoke(); + //On a client disconnect we want to take them back to the main menu. + //We have to check here in SceneManager if our active scene is the main menu, as if it is, it means we timed out rather than a raw disconnect; + if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "MainMenu") + { + // we're not at the main menu, so we obviously had a connection before... thus, we aren't in a timeout scenario. + // Just shut down networking and switch back to main menu. + MLAPI.NetworkManager.Singleton.Shutdown(); + SceneManager.LoadScene("MainMenu"); + } + else + { + NetworkTimedOut?.Invoke(); + } } }