Is there a way to detect disconnection from other player?

Options
Hello,

I'm using PUN2. I want to freeze the game when one the player is facing a disconnection.

To detect the other player disconnection I'm using
public override void OnPlayerLeftRoom(Player otherPlayer)
    {
Debug.log("The other player is disconnecting);
}

but between the time the player is disconnected and I receives the log, it can take up to 3 secs. That's way to long.
Is there any chance I can get a faster callback?

thanks

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Clevereen,

    By default, there will always be delays due to timeout.
    You could try to minimizing this delay by implementing your own custom hearbeat logic to detect disconnects early. See here for inspiration.

    There is also a way to make sure when a client calls LeaveRoom while app is quitting or moving to background it has more chance to reach the server. Here.