Skip to content

Commit 5a5fc05

Browse files
Merge pull request #651 from Unity-Technologies/fix/destroyobjectspam
fix: destroy object spam
2 parents 8a5ab8b + 5e04e7e commit 5a5fc05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

com.unity.multiplayer.mlapi/Runtime/Core/NetworkObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public static void NetworkHide(List<NetworkObject> networkObjects, ulong clientI
361361

362362
private void OnDestroy()
363363
{
364-
if (NetworkManager.Singleton != null)
364+
if (NetworkManager.Singleton != null && NetworkSpawnManager.SpawnedObjects.ContainsKey(NetworkObjectId))
365365
{
366366
NetworkSpawnManager.OnDestroyObject(NetworkObjectId, false);
367367
}

0 commit comments

Comments
 (0)