Disconnecting as the Host player.
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Fusion.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Disconnecting as the Host player.
crazyfisch
2022-12-02 17:14:29
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
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.
Back to top