I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom
method. This works well, until I use the RPC call with buffers.
There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point. So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.
There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom
, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview
, and it throw outs an error. It doesn't update the list.
Can I delay the buffer calls, is there a better way to change my scene while joining a room?