private void PlayerLoadedLevel(NetworkingPlayer player, NetworkingStream stream)
{
int levelLoaded = ObjectMapper.Map<int>(stream);
Unity.MainThreadManager.Run(() =>
{
// The level that was loaded is not the current level
if (levelLoaded != Application.loadedLevel)
return;
if (clientLoadedLevel != null)
clientLoadedLevel(player);
if (allClientsLoaded == null)
return;
if (++currentClientsLoaded >= OwningNetWorker.Players.Count)
{
allClientsLoaded();
currentClientsLoaded = 0;
}
});
}