Event for scene objects getting their initial OnPhotonSerializeView?

Options
So I've got a scene that contains some spawn points. Only one player can occupy a spawn point and the spawn point's occupation status gets updated in it's OnPhotonSerializeView.

I'm dealing with my player instantiation inside the OnJoinedRoom callback, but I've noticed that when it gets called, the spawn points in the scene haven't yet received a OnPhotonSerializeView call to update their occupation status, so it leads to players occupying the same point because it appears unoccupied when OnJoinedRoom is called.

The workaround I'm using is I put the instantiation stuff into a coroutine with a delay that gets started in OnJoinedRoom. With a .5 second delay, the spawn points seem to get updated in time, but with network congestion, this method seems like it could lead to problems.

Is there a built-in way to know when scene objects have been updated so you can move along with logic that requires them to have their current states accurate?

Comments

  • S_Oliver
    S_Oliver ✭✭✭
    Options
    You could avoid this scenario when the spawn/spawnpoint logic goes to the MasterClient. So only MasterClient is aware of all used spawnpoints, he will send the spawn infos to the new joined Player.