Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Photon JoinRandomRoom(expectedroomproperties, 12) Failed

Discussion in 'Connected Games' started by Claudiotheworm, Nov 10, 2018 at 11:39 PM.

  1. Claudiotheworm

    Claudiotheworm

    Joined:
    Jul 27, 2018
    Posts:
    10
    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:
    64
    tobiass and Claudiotheworm like this.
  3. Claudiotheworm

    Claudiotheworm

    Joined:
    Jul 27, 2018
    Posts:
    10
    Thank you! I'll try that for now.