In pohton fusion How do i disconnect session in Shared mode and Can I know the cause of the disconn


sorry because it's a google translator


I understand that disconnect session in Shared mode, NetworkRunner instance Release.

Is there another way to disconnect session?


If Disconnencted in an unexpected way (ex : app Forced Termination, Disconnect from the Internet)

How can i know Disconnencted Reasons? and How to Reconnect?

Best Answer

  • Isaac_Augusto
    Answer ✓

    Hi,

    The NetworkRunnerCallbacks gives you the OnShutdown callback, which have a ShutdownReason that you can use to know what cause the disconnection.

    To reconnect, simply create a new NetworkRunner and start it again. (Do not reuse NetworkRunners)

    -----

    Isaac Augusto

    Photon Fusion Team

Answers

  • Isaac_Augusto
    Answer ✓

    Hi,

    The NetworkRunnerCallbacks gives you the OnShutdown callback, which have a ShutdownReason that you can use to know what cause the disconnection.

    To reconnect, simply create a new NetworkRunner and start it again. (Do not reuse NetworkRunners)

    -----

    Isaac Augusto

    Photon Fusion Team

  • Thank you very much for the help

  • Hi,

    @Isaac_Augusto can you elaborate or point me to the documentation why not to reuse NetworkRunners?

    Because I use runner.Shutdown and runner.StartGame on the same runner instance to move the player between different network sessions without problems (yet). But when the player gets disconnected due to some technical issues (ShutdownReason != OK) then it seems like I cannot reconnect using the runner.StartGame on the same instance.

  • Hi @ManuKo ,

    I cannot point to the specific motive, but the NetworkRunner was made to be discarded after you shutdown, that's the general rule.

    Even if you're not having problems with it right now, I recommend you to create a new one every time you need it start a connection again.

    This way, you can discard this as a cause for any problem that you might have. (I had problems with this myself)

    -----

    Isaac Augusto

    Photon Fusion Team

  • Hi! I am trying to implement a reconnect feature in the case of a network problem. When calling Runner.shutdown we can specify whether we want to destroy the associated game object. But, it seems we don't have this option when the runner is shutdown due to a Photon cloud timeout error for example. Is there a way to prevent the automatic destruction of the game object?