@@ -1986,6 +1986,8 @@ private void OnClientLoadedScene(uint sceneEventId, Scene scene)
19861986 /// </summary>
19871987 internal Func < Scene , bool > ExcludeSceneFromSychronization ;
19881988
1989+ internal List < ulong > ClientConnectionQueue = new List < ulong > ( ) ;
1990+
19891991 /// <summary>
19901992 /// Server Side:
19911993 /// This is used for players that have just had their connection approved and will assure they are synchronized
@@ -1994,8 +1996,21 @@ private void OnClientLoadedScene(uint sceneEventId, Scene scene)
19941996 /// synchronized.
19951997 /// </summary>
19961998 /// <param name="clientId">newly joined client identifier</param>
1997- internal void SynchronizeNetworkObjects ( ulong clientId )
1999+ internal void SynchronizeNetworkObjects ( ulong clientId , bool synchronizingService = false )
19982000 {
2001+ // If this is a newly connecting client, add it to the connecting client queue
2002+ if ( ! synchronizingService && ! ClientConnectionQueue . Contains ( clientId ) )
2003+ {
2004+ ClientConnectionQueue . Add ( clientId ) ;
2005+ // If we are already synchronizing a client, then add this client to the queue and exit.
2006+ if ( ClientConnectionQueue . Count > 1 )
2007+ {
2008+ Debug . Log ( $ "Deferring Client-{ clientId } synchrnization.") ;
2009+ return ;
2010+ }
2011+ }
2012+
2013+
19992014 // Update the clients
20002015 NetworkManager . SpawnManager . UpdateObservedNetworkObjects ( clientId ) ;
20012016
@@ -2623,6 +2638,13 @@ private void HandleSessionOwnerEvent(uint sceneEventId, ulong clientId)
26232638 // DANGO-EXP TODO: Remove this once service distributes objects
26242639 NetworkManager . SpawnManager . DistributeNetworkObjects ( clientId ) ;
26252640 EndSceneEvent ( sceneEventId ) ;
2641+ ClientConnectionQueue . Remove ( clientId ) ;
2642+ Debug . Log ( $ "Client-{ clientId } synchronized.") ;
2643+ if ( ClientConnectionQueue . Count > 0 )
2644+ {
2645+ Debug . Log ( $ "Synchronizing Client-{ ClientConnectionQueue [ 0 ] } ...") ;
2646+ SynchronizeNetworkObjects ( ClientConnectionQueue [ 0 ] ) ;
2647+ }
26262648 break ;
26272649 }
26282650 default :
0 commit comments