Search Unity

Third Party PUN 2 OnPlayerLeftRoom is never called

Discussion in 'Multiplayer' started by Clashman, Jun 5, 2021.

  1. Clashman

    Clashman

    Joined:
    Feb 18, 2019
    Posts:
    53
    Hi !
    I have a little problem. I made a scene called "waiting room" where all player who joined a same room are listed.
    However, when a player quits the room, his prefab is'nt destroyed because the fnction OnPlayerLeftRoom is not called.
    I don't understand why...
    The player quits the room by clicking the a button that called LeaveRoom() function and make the player to go to title screen.

    Can u help me to resolve my problem ?

    Thanks for answers !
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    If OnPlayerLeftRoom is not called, this needs fixing first.
    When you call LeaveRoom(), don't call Disconnect() right after that.

    The problem could also be that the script (which is waiting for the callbacks) does not register for them. Are you sure the script gets callbacks at all?

    Enable the SupportLogger in the PhotonServerSettings and check the logs on both sides if you see the leave.