Sometimes other player is forced to leave room

Options
Hi,
I begin to develop a space ship game and I have an issue when I test 2 players game on 2 devices :
When a player die, he leaves the room ( that's ok) but sometimes the other player is forced to quit and rejoin the room.
I've tested with 3 players and It's the same issue. Not all other players quit but one or the other...
I used Marco Polo tuto to begin the code...

Any Idea?

Comments

  • [Deleted User]
    Options
    Hi @Yonathgames,

    I guess you have a condition which checks if the space ship has been destroyed and that you call PhotonNetwork.LeaveRoom() if that condition is true. In this case please make sure, that you have another condition, which checks if the destroyed space ship really belongs to the local player. An easy way for this would be using the PhotonView component of the space ship and add if (photonView.isMine) condition.
  • Yonathgames
    Options
    Thanks for the answer!

    I already use photonView.IsMine check before using my destruct function in which I call PhotonNetwork.LeaveRoom();

    I've made some tests and here what I find in the console when there are double leaving room

    onevent : event 254
    handleeventleave for playerID...
    Network destroy Instantiated GO : Vso(clone)
    operationresponse 254 returncode 0
    onstatusChanged disconnect current state disconnecting from gameserver
    Network destroy Instantiated GO : Vso(clone)
    onleft


    When there is a normal gameObject's shoot and die, there is only one "Network destroy Instantiated GO : Vso(clone)" and no "operationresponse 254 returncode 0
    onstatusChanged disconnect current state disconnecting from gameserver"

    Thank you



  • Yonathgames
    Options
    I 've found a solution. I thought sometimes, leaveRoom was called twice even if the player is destroyed the first time. So I only put photonView.isOwnerActive in the condition with photonView.isMine and it work!!