Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Third Party [PHOTON]Check my current lobby

Discussion in 'Multiplayer' started by Moddwyn, Apr 6, 2017.

  1. Moddwyn

    Moddwyn

    Joined:
    Jan 27, 2016
    Posts:
    49
    So I joined a lobby called "Game". When I try to do an if statement to check if my lobby is "Game" using PhotonNetwork.lobby, it returns false. When I debug PhotonNetwork.lobby.ToString(), it debugs 'Game'[DEFAULT]. So how do I check if my lobby is "Game"?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,076
    When you compare .lobby to "Game", what happens is that lobby.ToString() gets called and that gives you "'Game'[DEFAULT]". This is the name of the lobby and the type of it (in square brackets).
    You want to compare lobby.name to "Game".
     
  3. Moddwyn

    Moddwyn

    Joined:
    Jan 27, 2016
    Posts:
    49
    So I check if (PhotonNetwork.lobby.Name == "Game") and if it returns true, it will call PhotonNetwork.JoinRandomRoom I also debugged "joined game" when it returns true. The thing is, when i switch to Game lobby, it does debug "joined game", but it doesnt join a random room. I put a OnPhotonJoinRandomFailed but it doesnt get called. I also put a OnJoinedRoom but it also doesnt get called. What's happening?
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,076
    Moddwyn likes this.