NetworkServer.DestroyObject: added comments

This commit is contained in:
vis2k 2021-07-31 20:17:55 +08:00
parent e9f8af40f9
commit 3232001466

View File

@ -1228,18 +1228,17 @@ static void DestroyObject(NetworkIdentity identity, DestroyMode mode)
identity.connectionToClient?.RemoveOwnedObject(identity);
ObjectDestroyMessage message = new ObjectDestroyMessage
{
netId = identity.netId
};
SendToObservers(identity, message);
// send object destroy message to all observers, clear observers
SendToObservers(identity, new ObjectDestroyMessage{netId = identity.netId});
identity.ClearObservers();
// in host mode, call OnStopClient manually
if (NetworkClient.active && localClientActive)
{
identity.OnStopClient();
}
// we are on the server. call OnStopServer.
identity.OnStopServer();
// are we supposed to GameObject.Destroy() it completely?