@@ -28,15 +28,13 @@ public enum ConnectionEvent
2828 /// On the server side, the <see cref="ConnectionEventData.ClientId"/> will be the ID of the client that just connected.
2929 /// </remarks>
3030 ClientConnected ,
31-
3231 /// <summary>
3332 /// This event is set on clients that are already connected to the session.
3433 /// </summary>
3534 /// <remarks>
3635 /// The <see cref="ConnectionEventData.ClientId"/> will be the ID of the client that just connected.
3736 /// </remarks>
3837 PeerConnected ,
39-
4038 /// <summary>
4139 /// This event is set on the client-side of the client that disconnected client and on the server-side.
4240 /// </summary>
@@ -45,7 +43,6 @@ public enum ConnectionEvent
4543 /// On the server side, this will be the ID of the client that disconnected.
4644 /// </remarks>
4745 ClientDisconnected ,
48-
4946 /// <summary>
5047 /// This event is set on clients that are already connected to the session.
5148 /// </summary>
@@ -150,7 +147,7 @@ internal void InvokeOnClientConnectedCallback(ulong clientId)
150147 return ;
151148 }
152149
153- // Invoking connection event on NonAuthority client. Need to calculate PeerIds.
150+ // Invoking connection event on non-authority local client. Need to calculate PeerIds.
154151 var peerClientIds = new NativeArray < ulong > ( Math . Max ( NetworkManager . ConnectedClientsIds . Count - 1 , 0 ) , Allocator . Temp ) ;
155152 // `using var peerClientIds` or `using(peerClientIds)` renders it immutable...
156153 using var sentinel = peerClientIds ;
@@ -857,7 +854,6 @@ internal void HandleConnectionApproval(ulong ownerClientId, NetworkManager.Conne
857854 } ;
858855 }
859856 }
860-
861857 if ( ! MockSkippingApproval )
862858 {
863859 SendMessage ( ref message , NetworkDelivery . ReliableFragmentedSequenced , ownerClientId ) ;
@@ -866,7 +862,6 @@ internal void HandleConnectionApproval(ulong ownerClientId, NetworkManager.Conne
866862 {
867863 NetworkLog . LogInfo ( "Mocking server not responding with connection approved..." ) ;
868864 }
869-
870865 message . MessageVersions . Dispose ( ) ;
871866 message . ConnectedClientIds . Dispose ( ) ;
872867 if ( MockSkippingApproval )
@@ -883,8 +878,8 @@ internal void HandleConnectionApproval(ulong ownerClientId, NetworkManager.Conne
883878 {
884879 InvokeOnPeerConnectedCallback ( ownerClientId ) ;
885880 }
886-
887881 NetworkManager . SpawnManager . DistributeNetworkObjects ( ownerClientId ) ;
882+
888883 }
889884 else // Otherwise, let NetworkSceneManager handle the initial scene and NetworkObject synchronization
890885 {
@@ -927,7 +922,6 @@ internal void HandleConnectionApproval(ulong ownerClientId, NetworkManager.Conne
927922 {
928923 return ;
929924 }
930-
931925 // Separating this into a contained function call for potential further future separation of when this notification is sent.
932926 ApprovedPlayerSpawn ( ownerClientId , response . PlayerPrefabHash ?? NetworkManager . NetworkConfig . PlayerPrefab . GetComponent < NetworkObject > ( ) . GlobalObjectIdHash ) ;
933927 }
@@ -942,7 +936,6 @@ internal void HandleConnectionApproval(ulong ownerClientId, NetworkManager.Conne
942936 SendMessage ( ref disconnectReason , NetworkDelivery . Reliable , ownerClientId ) ;
943937 MessageManager . ProcessSendQueues ( ) ;
944938 }
945-
946939 DisconnectRemoteClient ( ownerClientId ) ;
947940 }
948941 }
@@ -1017,14 +1010,12 @@ internal NetworkClient AddClient(ulong clientId)
10171010 {
10181011 networkClient = new NetworkClient ( ) ;
10191012 }
1020-
10211013 networkClient . SetRole ( clientId == NetworkManager . ServerClientId , isClient : true , NetworkManager ) ;
10221014 networkClient . ClientId = clientId ;
10231015 if ( ! ConnectedClients . ContainsKey ( clientId ) )
10241016 {
10251017 ConnectedClients . Add ( clientId , networkClient ) ;
10261018 }
1027-
10281019 if ( ! ConnectedClientsList . Contains ( networkClient ) )
10291020 {
10301021 ConnectedClientsList . Add ( networkClient ) ;
@@ -1048,7 +1039,6 @@ internal NetworkClient AddClient(ulong clientId)
10481039 NetworkManager . MessageManager . SendMessage ( ref message , NetworkDelivery . ReliableSequenced , NetworkManager . CurrentSessionOwner ) ;
10491040 }
10501041 }
1051-
10521042 if ( ! ConnectedClientIds . Contains ( clientId ) )
10531043 {
10541044 ConnectedClientIds . Add ( clientId ) ;
@@ -1074,7 +1064,6 @@ internal NetworkClient AddClient(ulong clientId)
10741064 {
10751065 continue ;
10761066 }
1077-
10781067 networkObject . Observers . Add ( clientId ) ;
10791068 }
10801069 }
@@ -1092,7 +1081,6 @@ internal void RemoveClient(ulong clientId)
10921081 {
10931082 ConnectedClientIds . Remove ( clientId ) ;
10941083 }
1095-
10961084 if ( ConnectedClients . ContainsKey ( clientId ) )
10971085 {
10981086 ConnectedClientsList . Remove ( ConnectedClients [ clientId ] ) ;
@@ -1199,7 +1187,6 @@ internal void OnClientDisconnectFromServer(ulong clientId)
11991187 // Don't destroy (prefab handler will determine this, but always notify
12001188 NetworkManager . SpawnManager . DespawnObject ( ownedObject , false , true ) ;
12011189 }
1202-
12031190 NetworkManager . PrefabHandler . HandleNetworkPrefabDestroy ( ownedObject ) ;
12041191 }
12051192 else
@@ -1239,7 +1226,6 @@ internal void OnClientDisconnectFromServer(ulong clientId)
12391226 break ;
12401227 }
12411228 }
1242-
12431229 if ( EnableDistributeLogging )
12441230 {
12451231 Debug . Log ( $ "[Disconnected][Client-{ clientId } ][NetworkObjectId-{ ownedObject . NetworkObjectId } Distributed to Client-{ targetOwner } ") ;
@@ -1262,7 +1248,6 @@ internal void OnClientDisconnectFromServer(ulong clientId)
12621248 {
12631249 continue ;
12641250 }
1265-
12661251 // If the client owner disconnected, it is ok to unlock this at this point in time.
12671252 if ( childObject . IsOwnershipLocked )
12681253 {
0 commit comments