[Pun2] Room Properties not set

Options
Hello,
im tryin to port my Project from pun classic to Pun2. Working well so far until i created a Room.
I add CustomRoomPopertries in PhotonNetwork.CreateRoom.

see here : https://pastebin.com/wrf8c2Av

But when i try to get the props i get null reference Error.

see here: https://pastebin.com/0SBiv8KK

It works perfect in Pun Classic, so did anything changed ?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    Options
    Hi @S_Oliver,

    When do you try to get the custom room property (call GetMap)?
    Is it after IMatchmakingCallbacks.OnJoinedRoom callback is triggered or before?

    After seeing this code snippet:
    if (PhotonNetwork.CreateRoom(newRoomName, m_roomOptions, TypedLobby.Default))
                {
                    Debug.Log("Joined Room");
                    MapDatabase.LoadMap(waitingRoom);
                }
    You do know that Photon operations are asynchronous and calling CreateRoom does not mean you are instantly joined to the room. CreateRoom returns if the client succeeded to add the room creation command to the queue of commands to send to the server and nothing more.
    You need to wait until the success or failure callback is triggered to know the outcome of the room creation request.

    It works perfect in Pun Classic, so did anything changed ?
    Could you share the full source code in PUN Classic and in PUN2? by full I mean, when do you try to get the custom room property.
  • S_Oliver
    S_Oliver ✭✭✭
    edited February 2019
    Options
    Hello @JohnTube ,

    thanks for the quick respones.

    Here is the full code https://github.com/SradnickDev/Photon-Example/blob/master/Assets/Menu-Network/RoomOverview/Scripts/CreateRoom.cs from my Photon Classic Project where i create the Room.

    https://github.com/SradnickDev/Photon-Example/blob/master/Assets/Menu-Network/WaitingRoom/WaitingRoom.cs On Line 66 i waited for OnJoinedRoom to be called, after scene loading.

    One mistake i made now with Pun2 was putting line 66 in a Start method, because OnJoinedRoom seems not to be called.

    Is it not called because i call CreateRoom in a Scene than changing to another Scene and hopping that OnJoinedRoom will be called?
  • S_Oliver
    Options
    Do i have to inherit from MonobehaviourPunCallbacks and implement the IMatchMakingCallbacks ?
  • S_Oliver
    Options
    Ok, i got it.Thanks.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    So all good?
  • S_Oliver
    Options
    Yeah, all good. thx