better comments

This commit is contained in:
vis2k 2021-07-31 12:20:25 +08:00
parent 7071a6afc8
commit e951abeb34

View File

@ -1231,14 +1231,13 @@ static void DestroyObject(NetworkIdentity identity, bool destroyServerObject)
identity.OnStopServer(); identity.OnStopServer();
// when unspawning, don't destroy the server's object // only .Destroy() if we are supposed to destroy it on server
if (destroyServerObject) if (destroyServerObject)
{ {
identity.destroyCalled = true; identity.destroyCalled = true;
UnityEngine.Object.Destroy(identity.gameObject); UnityEngine.Object.Destroy(identity.gameObject);
} }
// if we are destroying the server object we don't need to reset the identity // otherwise simply .Reset() it.
// reseting it will cause isClient/isServer to be false in the OnDestroy call
else else
{ {
identity.Reset(); identity.Reset();