File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public bool isHost
4444
4545 public bool IsClientConnected ;
4646 public Action OnClientConnectedCallback = null ;
47+ public Action OnClientDisconnectCallback = null ;
4748
4849 public NetworkingConfiguration NetworkConfig ;
4950
@@ -341,6 +342,8 @@ private void Update()
341342 }
342343 else
343344 {
345+ if ( OnClientDisconnectCallback != null )
346+ OnClientDisconnectCallback . Invoke ( ) ;
344347 IsClientConnected = false ;
345348 }
346349 }
@@ -386,7 +389,12 @@ private void Update()
386389 if ( isServer )
387390 OnClientDisconnect ( clientId ) ;
388391 else
392+ {
393+ if ( OnClientDisconnectCallback != null )
394+ OnClientDisconnectCallback . Invoke ( ) ;
395+
389396 IsClientConnected = false ;
397+ }
390398 break ;
391399 }
392400 // Only do another iteration if: there are no more messages AND (there is no limit to max events or we have processed less than the maximum)
You can’t perform that action at this time.
0 commit comments