multiplayer-community-contributions icon indicating copy to clipboard operation
multiplayer-community-contributions copied to clipboard

Lobby.IsValid still true after calling Lobby.Leave()

Open MagnusMakesGames opened this issue 1 year ago • 2 comments

Hello, I am having an issue with Lobby.Leave() in my game, when calling it, Lobby.IsValid is still true, and I can't join any other lobbies. Here is my Disconnect function:

public void Disconnect(bool returnToMenu = false) { Debug.Log("Disconnecting from lobby");

    if(NetworkManager.Singleton != null)
        NetworkManager.Singleton.Shutdown();

    if(currentLobby.HasValue)
    {
        currentLobby.Value.Leave();
        //currentLobby = null;
    }

    if(returnToMenu)
        SceneManager.LoadScene("MainMenu");
}

I have been trying to fix this issue for over a week now, if anyone knows of a solution please let me know!

MagnusMakesGames avatar May 05 '24 14:05 MagnusMakesGames

I found a workaround, Replacing the NetworkManager, Facepunch Transport and my lobby script with a new one when the player returns to the lobby after calling the disconnect function seems to fix the problem.

MagnusMakesGames avatar May 06 '24 15:05 MagnusMakesGames

Nevermind, after testing this with my friend, it seems to just crash my game when i try to join someone.

MagnusMakesGames avatar May 07 '24 09:05 MagnusMakesGames