TTL problems

Options

Working on rejoin logic. I set TTL for the room to 5 minutes.

Works correctly if a player crashes or loses internet connection. But if they actually choose to quit the level and PhotonNetwork.Disconnect() is called, they stay in the level for 5 minutes still? That has to be a bug right? If not, i don't understand, how do i get the player to leave a level immediately? TTL should just be for handling unwanted disconnects right? Not intended disconnects?


PUN1 Latest, near to latest Unity.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2019
    Options

    Hi @Statigar,

    If you want to leave the room for good even if PlayerTTL != 0, then call PhotonNetwork.LeaveRoom(false) instead of PhotonNetwork.LeaveRoom() or PhotonNetwork.LeaveRoom(true) or PhotonNetwork.Disconnect().

  • Statigar
    Options

    I'm using PhotonNetwork.Disconnect(), but it's still taking 5 minutes to leave the room.

    I also tried PhotonNetwork.LeaveRoom(true) and PhotonNetwork.LeaveRoom(false) but it has the same problem.

    How would i tell if Photon is experiencing any difficulty leaving the room? maybe it can't process the leaving correctly so it's counting it as an unintended disconnect?

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options

    Unexpected disconnects, PhotonNetwork.Disconnect(), PhotonNetwork.LeaveRoom() and PhotonNetwork.LeaveRoom(true) will not remove the actor from the room if PlayerTTL != 0. Instead the actor will become inactive first.


    You need to use PhotonNetwork.LeaveRoom(false) which works as expected.

    If you also want to disconnect (why?) call PhotonNetwork.Disconnect() inside OnLeftRoom() callback.