JoinRoom() and OnJoinRoomFailed() not working as expected?

Options
So I was working on a code that when the player clicks a button, it would call
PhotonNetwork.JoinRoom("myRoom");
but in this case, room "myRoom" doesn't exist.
When I pressed the button, I would expect it to call OnJoinRoomFailed() because it doesn't exist, which in my code would just Debug.Log("can't join room");

But for some reason, it doesn't call it. When I looked at PhotonNetwork.NetworkClientState, it was at 'JoinedLobby', but after I click the button, it would go back to 'ConnectedToMaser'. So I'm seeing that joining a room that doesn't exist puts you back to the master server, and would have to join back to the lobby again.

Is this how this supposed to work? Or is there something I'm missing.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Moddwyn,

    Thank you for choosing Photon!

    What PUN version is this?
    About the callback not being called, maybe it's not implemented properly or not registered?
    Did you register the class implementing it as a callbacks class like shown in the documentation?

    I think when room creation or join fails or if you reconnect you're back to the master server and need to manually rejoin the lobby yes.
  • Moddwyn
    Options
    @JohnTube Thank you for responding.
    I am using PUN 2 and yes I have implemented MonoBehaviourPunCallbacks. I have functions like OnConnectedToMaster() and OnJoinedLobby() working.
    I think when room creation or join fails or if you reconnect you're back to the master server and need to manually rejoin the lobby yes.
    I was implementing a small system where when a player doesn't find the room, a message shows up, so I want the OnJoinRoomFailed() to be called on purpose, but it is instead going straight to the master server.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Moddwyn,

    If you call JoinRoom it returns a boolean.
    Is it true or false.
    If you call JoinRoom what callback(s) are triggered?