mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
CleanupNetworkIdentities: better comments and call DestroyObject with DestroyMode.Destroy for spawned prefabs directly. more obvious.
This commit is contained in:
parent
beff4b634a
commit
47bd2b7c78
@ -129,21 +129,19 @@ static void CleanupNetworkIdentities()
|
||||
{
|
||||
if (identity != null)
|
||||
{
|
||||
// spawned scene objects are reset and disabled.
|
||||
// they always stay in the scene, we don't destroy them.
|
||||
// scene object
|
||||
if (identity.sceneId != 0)
|
||||
{
|
||||
// spawned scene objects are only reset and disabled.
|
||||
// they always stay in the scene, we don't destroy them.
|
||||
identity.Reset();
|
||||
identity.gameObject.SetActive(false);
|
||||
}
|
||||
// spawned prefabs are destroyed
|
||||
// spawned prefabs
|
||||
else
|
||||
{
|
||||
// call NetworkServer.Destroy directly instead of
|
||||
// GameObject.Destroy()->
|
||||
// NetworkIdentity.OnDestroy()->
|
||||
// NetworkServer.Destroy()
|
||||
Destroy(identity.gameObject);
|
||||
// spawned prefabs are unspawned and destroyed.
|
||||
DestroyObject(identity, DestroyMode.Destroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user