Creating and Joining Rooms with Scene Changing

Options
I know how to create and join a room if I do everything in one scene..

But now I am trying to use two scenes. One which contains just the main menu, game list, settings etc.
And another scene where everything "happens".

In this scene, based on the map name, it spawns a different environment. Rather than having a scene for each map.

What I'm not sure of, when connecting to someones room. Should I connect to the room, turn off message queue, then load the scene? Or another method? Also, I'm wondering how I can use custom room data, for things like the map name, gamemode type etc.

Any help would be awesome! Thanks!

Comments

  • vadim
    Options
    PhotonNetwork has LoadLevel method. Check its help for details. It pauses message queue automatically.

    Custom room properties may be set in PhotonNetwork.CreateRoom call (roomOptions parameter) or by calling PhotonNetwork.Room.SetCustomProperties(...) while connected to the room.
    Use PhotonNetwork.Room.customProperties to read properties while connected to the room. They are synchronized between clients automatically.
  • J_Troher
    Options
    Would you have an example of setting them in CreateRoom? I'm really only trying to pass 2 strings, gamemode and map.. or a string and a GameObject.. if possible.
  • vadim
    Options
    CreateRoom has roomOptions parameter.
    Set roomOptions.customRoomProperties to Hashtable with string keys (names of properties) and values supported by PUN (basic types as string and containers: Hashtable, array).
  • J_Troher
    Options
    I've looked at The Documentation, I just dont understand the hashtable. I'm not sure exactly how I'd put my gamemode and map string in it, and then set them...
  • J_Troher
    Options
    RoomOptions options = new RoomOptions() { isVisible = true, maxPlayers = _maxPlayers };
    PhotonNetwork.CreateRoom(_GameName, options, TypedLobby.Default );

    This is how I create my rooms. I the host sets the max players and the game name. I would love to be able to set a gamemode and map string in the same fashion. So I could display the information in my room list the same way I do the name and players/maxplayers. (Which will also be how your client knows which "map" to load when you join somebody's room)
  • vadim
    Options
    options.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "prop1", "bla" }, { "prop2", 4 } };
    Also you may need next line to make properties visible in lobby:
    options.customRoomPropertiesForLobby = new string[] { "prop1", "prop2" };