mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00: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)
|
if (identity != null)
|
||||||
{
|
{
|
||||||
// spawned scene objects are reset and disabled.
|
// scene object
|
||||||
// they always stay in the scene, we don't destroy them.
|
|
||||||
if (identity.sceneId != 0)
|
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.Reset();
|
||||||
identity.gameObject.SetActive(false);
|
identity.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
// spawned prefabs are destroyed
|
// spawned prefabs
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// call NetworkServer.Destroy directly instead of
|
// spawned prefabs are unspawned and destroyed.
|
||||||
// GameObject.Destroy()->
|
DestroyObject(identity, DestroyMode.Destroy);
|
||||||
// NetworkIdentity.OnDestroy()->
|
|
||||||
// NetworkServer.Destroy()
|
|
||||||
Destroy(identity.gameObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user