Assigning Persistent Player Number

Options
This is the scenario, I have 4 players in a room. I want a player to keep it's player number when it disconnects and reconnects. How do I do that?

I remember reading something about this in the forums but I can't find it anymore. :neutral:

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2017
    Options
    Hi @johnny_tictoc,

    In Photon Unity SDK:
    Please create rooms with PlayerTTL != 0 and CheckUserOnJoin = true.
    This way actors can persist in the room's ActorList as inactive when they leave using OpLeave(true) and return to room with same ActorNr using OpReJoinRoom(roomName).

    In PUN:
    I think some of the features are not enabled yet.
    What you can do is:
    - create rooms with PlayerTTL != 0.
    - make use of ReconnectAndRejoin() for quick rejoin or ReJoinRoom(roomName).
  • @JohnTube That is very helpful! Thank you!
  • @JohnTube But what if the player got disconnected unintentionally (e.g. lost connection or crash)? He won't be able to call OpLeave(true).
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Unintentional/unexpected/implicit disconnects should count as temporary leave.