[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 ?
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 ?
0
Comments
-
Hi @S_Oliver,
When do you try to get the custom room property (callGetMap
)?
Is it afterIMatchmakingCallbacks.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 callingCreateRoom
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.1 -
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?0 -
Do i have to inherit from MonobehaviourPunCallbacks and implement the IMatchMakingCallbacks ?0
-
Ok, i got it.Thanks.0
-
So all good?1
-
Yeah, all good. thx1