Duplicate OnLeave callbacks while playerTtl > 0

Hi!
I have a room with playerTtl equal to 20000 and a couple of players within it. If any of those players has connection problems then OnLeave callback is called twice: the first time is not exactly after the player has left the room but a bit later and the second time is (or seemed like) the playerTtl period after the first one.
So I wonder if this is the expected behaviour? If it is, why is it so and is there a way to detect if this was the first callback for the exact player or the second?

Comments

  • Hi @Djebedia,

    Thank you for choosing Photon!

    I assume this is about PUN2 and the OnLeave callback is actually OnPlayerLeftRoom.
    Yes, this is the expected behaviour.
    IInRoomCallbacks.OnPlayerLeftRoom(Player otherPlayer) is called when the player leaves the room (sometimes after disconnection timeout) or when the PlayerTTL expires.
    You can know which player using the argument passed to the callback.
  • Thanks for replying!

    And I'm sorry for my English! )
    JohnTube said:

    I assume this is about PUN2 and the OnLeave callback is actually OnPlayerLeftRoom.
    Yes, this is the expected behaviour.
    IInRoomCallbacks.OnPlayerLeftRoom(Player otherPlayer) is called when the player leaves the room (sometimes after disconnection timeout) or when the PlayerTTL expires.

    Well, I guess it's just PUN classic v1.90 - not PUN2, and I'm still talking about PluginBase.OnLeave(ILeaveGameCallInfo info). But anyway if it's called twice: on disconnect and when PlayerTTL expires - that's fine, but still I have a question:
    JohnTube said:

    You can know which player using the argument passed to the callback.

    I wasn't wondering about which player it is, I was trying to figure out if current player's disconnect is already processed, so I don't have to do it again on the second time the OnLeave event is called - is there such a way?


  • Well, I think I've figured it out: the IsInactive property of ILeaveGameCallInfo argument is set to true until the player is finally kicked from the server. )
  • the IsInactive property of ILeaveGameCallInfo argument is set to true until the player is finally kicked from the server
    yes, that's it.
    You didn't mention anything about plugins so I didn't consider it at all.
    We usually redirect or expect the discussions about Plugins to be in the Photon Server category.
  • Oh, I'm sorry - I'm new to this forum and Photon itself )
  • Hey @Djebedia,

    no worries! you are doing great as a someone just starting with Photon :)
Sign In or Register to comment.