PeerState: Disconnecting

Hasi
Hasi
Hello Everyone I am working on a multiplayer FPS game where a player can create a room and other players can join the room but sometime some clients disconnects from server and get this error message.

Cannot send op: 225 Not connected. PeerState: Disconnecting
Cannot send op: 225 Not connected. PeerState: Connecting

And my code is this.

void Start () { Connect(); } void Connect(){ if (CreateOrJoin.CreateRoom) { PhotonNetwork.ConnectUsingSettings ("Version 01"); } else if (CreateOrJoin.JoinRoom) { PhotonNetwork.JoinRoom (SelectedRoom.Selected_Room); } } void OnJoinedLobby(){ Debug.Log ("OnJoinedLobby"); PhotonNetwork.JoinRandomRoom (); } void OnPhotonRandomJoinFailed(){ Debug.Log ("OnPhotonRandomJoinFailed"); CreateRoom (); } void OnJoinedRoom(){ Debug.Log ("OnJoinedRoom"); Connecting = true; SpawnPlayer (); }
Any help will be appreciated as I am stuck with this and searched a lot didn't find a solution.

Answers

  • Hi @Hasi,

    Operation 225 is the 'JoinRandomGame' operation and the error message states, that you are trying to send this operation while not being connected to Photon. Please check if you call PhotonNetwork.JoinRandomRoom(); when you are actually not connected. Also check if there are other PhotonNetwork.JoinRandomRoom(); calls in your code which get called while not being connected.
  • Thanks @Christian_Simon for your kind reply.

    Sir, I am not getting this error while connecting a room instead I am getting this error while playing the game. That mean I am definitely connected with Photon Network. And yes I am calling PhotonNetwork.JoinRandomRoom() but after connecting with photon network. Plz help me as this is my final year project.