How to clear the Message Queue before leaving a room?

Options
Hello again,

My problem is kinda strange. When a player joins a game that has already started I make isMessageQueueRunning = false until they are in the same scene as the rest of the players, but this causes a problem when the player tries to leave the room before they get to the scene.

If I make isMessageQueueRunning = true before/after calling PhotonNetwork.LeaveRoom() the MessageQueue runs and Instantiates and other stuff before the player leaves, this then causes a lot of errors and breaks the main menu.

On the other hand if I keep isMessageQueueRunning = false, the player gets stuck in the room in a sense and the main menu also breaks because Onleftroom is never called.

Is there a way I can clear the messageQueue (I believe it is somewhere in PhotonPeer but I do not have access to that)? or is there something else I can do to remedy this?

Thanks! @Tobias

Comments

  • vadim
    Options
    Hi,

    You can not cleanup messages. Try call Disconnect() and connect again instead of leaving the room.
  • Ok I will try that thanks.

    Also one last quick question. Is there a way to receive and send PhotonPlayer custom property info when isMessageQueueRunning = false??

    Thanks again.
  • vadim
    Options
    You can call PhotonNetwork.SendOutgoingCommands() after setting custom property to force sending outgoing commands including "properties" one.
    The only way to receive properties update (and messages preceding this update) is enabling message queue.