Don't destroy player if internet connection is lost

hello developers,
whenever the internet connection is lost my main player is destroyed (obviously because it have a photonView attached).
Is there any way by which I can prevent this from happening ? what I want is whenever a user looses his Internet connection the game remain as it is just the other players gets destroyed.

any help would be appreciated : )


  • Hi @Divyansh,

    you can use PhotonNetwork.autoCleanUpPlayerObjects = false; before creating the room. Using this each object created by a certain client will remain in the game if the related client disconnects from the game. Note: this applies for regular disconnects (client leaves the room) , too, means that you have to manually clean things up if you have to.

    If you want to give players a chance to reconnect after their internet connection is restored, you have to use the RoomOptions and apply them while creating the room. Using the RoomOptions you have to set the PlayerTtl value to something unequal to and larger than 0. If you want to keep the room alive for a certain amount of time, you can do this by setting the EmptyRoomTtl value.
  • Hi @Christian_Simon
    I think that is exactly what I was looking for , will try it soon , Thank you so much.
Sign In or Register to comment.