mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: NetworkServer.OnDisconnect now calls DestroyPlayerForConnection if NetworkManager doesn't handle it.
This commit is contained in:
parent
eadda02701
commit
939f2820ea
@ -424,18 +424,25 @@ internal static void OnTransportDisconnected(int connectionId)
|
||||
RemoveConnection(connectionId);
|
||||
// Debug.Log("Server lost client:" + connectionId);
|
||||
|
||||
// call OnDisconnected event.
|
||||
// NetworkManager hooks into it with a virtual function to make
|
||||
// DestroyPlayerForConnection(conn) optional, e.g. for PvP MMOs
|
||||
// where players shouldn't be able to escape combat instantly.
|
||||
// call OnDisconnected below. it's used in multiple places.
|
||||
OnDisconnected(conn);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnDisconnected(NetworkConnection conn)
|
||||
{
|
||||
OnDisconnectedEvent?.Invoke(conn);
|
||||
//Debug.Log("Server lost client:" + conn);
|
||||
// NetworkManager hooks into OnDisconnectedEvent to make
|
||||
// DestroyPlayerForConnection(conn) optional, e.g. for PvP MMOs
|
||||
// where players shouldn't be able to escape combat instantly.
|
||||
if (OnDisconnectedEvent != null)
|
||||
{
|
||||
OnDisconnectedEvent.Invoke(conn);
|
||||
}
|
||||
// if nobody hooked into it, then simply call DestroyPlayerForConnection
|
||||
else
|
||||
{
|
||||
DestroyPlayerForConnection(conn);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnError(int connectionId, Exception exception)
|
||||
|
Loading…
Reference in New Issue
Block a user