Determine if left room because PhotonNetwork.CloseConnection() called remotely?

Hello,

In our project, we use CloseConnection as part of banning players, and in reading the docs, and other forum posts I can see that this causes that player to leave the room. My issue is that the OnLeftRoom() callback will fire for other reasons as well (loss of internet, deliberate leaving of room etc..), I want a way to know if a remotely executed CloseConnection is the reason our player left the room. Is there a way to determine this out of the box?

Comments

  • It's a little hacky, but I found you can check for the raised event with the CloseConnection code.
    void IOnEventCallback.OnEvent(EventData photonEvent)
        {
            if (photonEvent.Code == 203) //PunEvent.CloseConnection (not public)
            {
                Debug.Log("Was kicked");
            }
        }
    
Sign In or Register to comment.