Skip to content

Commit 81bc09d

Browse files
fix: run disconnect callback before internal disconnect logic (#1221) (#1467)
* fix: run disconnect callback before internal disconnect logic * fix: standards.py Co-authored-by: Luke Stampfli <[email protected]>
1 parent df39c7b commit 81bc09d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ public IReadOnlyList<ulong> ConnectedClientsIds
345345
/// </summary>
346346
public event Action<ulong> OnClientDisconnectCallback = null;
347347

348-
internal void InvokeOnClientDisconnectCallback(ulong clientId) => OnClientDisconnectCallback?.Invoke(clientId);
349-
350348
/// <summary>
351349
/// The callback to invoke once the server is ready
352350
/// </summary>
@@ -1310,6 +1308,8 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, A
13101308
#if DEVELOPMENT_BUILD || UNITY_EDITOR
13111309
s_TransportDisconnect.Begin();
13121310
#endif
1311+
OnClientDisconnectCallback?.Invoke(clientId);
1312+
13131313
clientId = TransportIdToClientId(clientId);
13141314

13151315
m_TransportIdToClientIdMap.Remove(transportId);
@@ -1328,9 +1328,6 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, A
13281328
{
13291329
Shutdown();
13301330
}
1331-
1332-
OnClientDisconnectCallback?.Invoke(clientId);
1333-
13341331
#if DEVELOPMENT_BUILD || UNITY_EDITOR
13351332
s_TransportDisconnect.End();
13361333
#endif

0 commit comments

Comments
 (0)