The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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".

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
2023-03-24 23:27:09

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