Question about PlayerTtl
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Question about PlayerTtl
cmy
2017-07-08 22:46:06
Regarding PlayerTTL, the documentation states that
"If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds."
So my question are
does the application need to perform anything when the actor become "inactive"? Or this is transparent and either everything returns to normal after the client "reconnect", or the MasterClient will receive a OnPlayerDisconnected after the time out?
Does the disconnect client need to do anything in order to attempt the "reconnect" in question 1?
Thanks
David
Comments
Hi @cmy,
Thank you for choosing Photon!
- I didn't really understand the question.
- Player can be come inactive due to unexpected disconnect or explicitly by calling e.g.
OpLeaveRoom(true)
. - MasterClient can be the actor becoming inactive.
- When an actor becomes inactive or active again there is a callback for that:
OnPhotonPlayerActivityChanged (PhotonPlayer otherPlayer)
. - If the room is still alive and PlayerTTL expires you should get a callback
OnPhotonPlayerDisconnected (PhotonPlayer otherPlayer)
.
- Sometimes if EmptyRoomTTL < PlayerTTL when last player leaves, the room can be closed before PlayerTTL expiration.
- PlayerTTL = -1 or int.MaxValue mean infinite.