Changing scene while joinin room and RPC buffer problem.

Options
Hello.
I have a button to create and join a random room in my main menu. After the client joins (or creates and joins) a random room, i change the scene to game(main) scene in "OnJoinedRoom" function.
It works well untill i use RPC call with buffers.

There are 5 spawn points in game scene, and everytime a player joins the room, it "occupys" a spawn point, so noone else can spawn at that point.
So i have list of spawn points in my code, and everytime a player joins, it randomly picks a point from that list and "removes" it from the list, and does this by a RPC call so, whoever joins the game after, they remove that point too.

But there is a problem with that RPC's buffer because of the "scene change" thing. As i said, i "join a room" and then "change the scene" when the "OnJoinedRoom" gets called.
Because of this, RPC buffers are called just when the player joins the room, and before the scene change.
And because the scene hasn't changed yet, it troubles to find the buffered photonview. I throw outs an error, and doesn't update that list.

Can i delay the buffer calls? Or how else should i change my scene while joining a room? What am i doing wrong?

Comments

  • Tobias
    Options
    You could try PhotonNetwork.LoadLevel().
    Important: "To sync the loaded level in a room, set PhotonNetwork.automaticallySyncScene to true."
    For details, check the Api reference.