From 561e33ffea1859270f35fe351e4599b5a29d7296 Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Thu, 4 Jul 2024 10:31:45 -0400 Subject: [PATCH] fix(NetworkConnectionToClient): DestroyOwnedObjects use RemovePlayerForConnection for scene objects instead of UnSpawn - Scene objects need to stay alive for everyone else by default - Users can choose to Unspawn for themselves. --- Assets/Mirror/Core/NetworkConnectionToClient.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Core/NetworkConnectionToClient.cs b/Assets/Mirror/Core/NetworkConnectionToClient.cs index 361b00c34..68e205fd3 100644 --- a/Assets/Mirror/Core/NetworkConnectionToClient.cs +++ b/Assets/Mirror/Core/NetworkConnectionToClient.cs @@ -204,10 +204,9 @@ internal void DestroyOwnedObjects() { if (netIdentity != null) { - // unspawn scene objects, destroy instantiated objects. - // fixes: https://github.com/MirrorNetworking/Mirror/issues/3538 + // disown scene objects, destroy instantiated objects. if (netIdentity.sceneId != 0) - NetworkServer.UnSpawn(netIdentity.gameObject); + NetworkServer.RemovePlayerForConnection(this, RemovePlayerOptions.KeepActive); else NetworkServer.Destroy(netIdentity.gameObject); }