Disconnecting as the Host player.

Hello,

how do I close/disconnect a session as the host ?

Using NetworkRunner.Disconnect("hostID") does not work, it produces an index out of bounds exception in "Simulation".

SimulationConnection connection = this._connections[(int) player];

Since the host player has an ID of maxPlayerNumber-1 (right ?)

When another player joins and wants to disconnect that works just fine.

Now that kinda makes sense because how would the server disconnect itself ?

But when the server is also a player, how can I leave a session as the host ?

I can just Runner.Shutdown() and reload my menu/lobby scene but that feels like not the optimal thing to do.

If you have any ideas or questions feel free to ask.

Best Regards

CrazyFisch

Comments

  • Elchtest
    Elchtest
    edited March 2023

    Same question here. Calling

    _runner.Disconnect(_runner.LocalPlayer);

    throws: IndexOutOfRangeException: Index was outside the bounds of the array.


    Runner.Shutdown() as suggested above does work for getting the runner disconnected, however, when using the Fusion Voice Client, it stays connected (Client State: Joined) even after that call.