Search Unity

Photon JoinRandomRoom(expectedroomproperties, 12) Failed

Discussion in 'Connected Games' started by Claudiotheworm, Nov 10, 2018.

  1. Claudiotheworm

    Claudiotheworm

    Joined:
    Jul 27, 2018
    Posts:
    24
    I have an issue. When Player A creates a room, Player B does not detect that room, and creates their own room. Here's my code...
    Code (CSharp):
    1. public override void OnConnectedToMaster()
    2.         {
    3.             //set my own name and try joining a game
    4.             PhotonNetwork.playerName = PlayerPrefs.GetString(PrefsKeys.playerName);
    5.             Hashtable expectedCustomRoomProperties;
    6.             expectedCustomRoomProperties = new Hashtable() { { "map", 1 } };
    7.             PhotonNetwork.JoinRandomRoom(expectedCustomRoomProperties, 12);
    8.         }
    9.    
    10.  
    11.         /// <summary>
    12.         /// Called when a joining a random room failed.
    13.         /// See the official Photon docs for more details.
    14.         /// </summary>
    15.         public override void OnPhotonRandomJoinFailed(object[] codeAndMsg)
    16.         {
    17.             Debug.Log("Photon did not find any matches on the Master Client we are connected to. Creating our own room... (ignore the warning above).");
    18.             RoomOptions roomOptions = new RoomOptions();
    19.            
    20.             roomOptions.CustomRoomProperties = new Hashtable() { { "map", 1 } };
    21.             roomOptions.MaxPlayers = 12;
    22.             //joining failed so try to create our own room
    23.             PhotonNetwork.CreateRoom(null, roomOptions, null);
    24.         }
    When I remove the expectedCustomRoomProperties, the thing works. But I need some sort of filter so I need that code.
     
  2. sandbaydev

    sandbaydev

    Joined:
    Aug 9, 2013
    Posts:
    68
    tobiass and Claudiotheworm like this.
  3. Claudiotheworm

    Claudiotheworm

    Joined:
    Jul 27, 2018
    Posts:
    24
    Thank you! I'll try that for now.
     
    sandbaydev likes this.