Can I send the cause of Player Disconnect with the photon Player left event?

fzehra123
fzehra123
edited June 21 in DotNet

I want the network users to know the reason why a player left, was it intentional or accidental. Since I have set the player TTL to 15 sec, I get the player left event twice, first immediately as soon as the player leaves and second after 15 sec. If the network users would know that the player had intentionally left the room then nothing needs to be done on the second event.

Can I do this without creating a separate custom event?

Answers

  • Tobias
    Tobias admin

    If the intentional "leave" means the player wants to leave the room "right away", you can pass a parameter to Leave() to not become inactive (and instead leave the room immediately).

    This could be used to separate connection loss situations from those who leave immediately (the latter don't become inactive initially).

  • fzehra123
    fzehra123
    edited June 23

    Thanks for your reply. "Intentional Leave" means deliberately disconnecting from Photon, and not because of any network issue. Can you elaborate how can I pass some parameter to the Leave event?? Does that mean I need to extent the LoadbalancingPeer class? Where is the disconnect information being send to the network? My best analysis is that PhotonPeer class is managing disconnection but that code is all meta-data. Please help

  • Tobias
    Tobias admin

    Use LoadBalancingClient.OpLeaveRoom(). Explanation is linked.