Minor docs error

The PDF manual says
//Join a room (creates if it does not exists) 
PhotonNetwork.JoinRoom(roomName);
But I get a "game does not exist" exception if I call that on a nonexistent room.

Comments

  • Thanks, this has been corrected for 1.8.
  • Hello,
    I am using v1.8 and it still does not work. (I just re-imported it to be sure).

    joinGame failed, client stays on masterserver: OperationResponse 226: ReturnCode: 32758 (Game does not exist). Parameters: {}.

    Also, I noticed in the code: JoinRoom(Room room) just calls this... JoinRoom(room.name);

    What if I setup "Room" with a hash table of properties.. it would never get in there.

    -Carmine
  • Leepo meant, that the docs have been corrected: It intended behavior, that you can only join exisiting rooms and have to call createRoom to create a new one.
  • If you want to join just any room, do this:
    • Try JoinRandomRoom
    • Implement OnPhotonRandomJoinFailed and make it create a room if needed (make sure to set maxPlayers or you will end up with one room)
  • Tobias wrote:
    If you want to join just any room, do this:
    • Try JoinRandomRoom
    • Implement OnPhotonRandomJoinFailed and make it create a room if needed (make sure to set maxPlayers or you will end up with one room)

    I'm following the Marco Polo tutorial and I still get an exception.
    joinrandom failed, client stays on masterserver: OperationResponse 225: ReturnCode: 32760 (No match found). Parameters: {}.
    UnityEngine.Debug:LogError(Object)
    PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)
    NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:680)
    NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:876)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:79)
    

    This is all the code I have in the project:
    using UnityEngine;
    using System.Collections;
    
    public class RandomMatchmaker : MonoBehaviour {
    
    	// Use this for initialization
    	void Start () {
    		PhotonNetwork.ConnectUsingSettings("devel");
    	}
    	
    	// Update is called once per frame
    	void OnGUI () {
    		GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
    	}
    	void OnJoinedLobby(){
    		PhotonNetwork.JoinRandomRoom();	
    	}
    	void OnPhotonRandomJoinFailed(){
    		PhotonNetwork.CreateRoom(null);
    	}
    }
    
    I still get this error using both 1.9 localhost server, and the cloud trial.
    Am I doing something wrong?

    EDIT:
    In retrospect, try probably means try... not sure why I figured that method would handle the exception. Well, the docs aren't idiot prof, apparently.
  • Yes, JoinRandomRoom can fail. After all, there's no guarantee that any game is currently available.
    The demo goes on to create a room and the next player will join (randomly).

    The log output in this case is a bit misleading. It should be a warning or info.
    Sorry to confuse you.
Sign In or Register to comment.