From 83cb6a85f045e41d894a5f55d71db6632b4c34a8 Mon Sep 17 00:00:00 2001 From: MS-crew <100300664+MS-crew@users.noreply.github.com> Date: Sun, 26 Apr 2026 17:16:26 +0300 Subject: [PATCH] Refactor object spawn and unspawn logic --- .../Exiled.API/Extensions/MirrorExtensions.cs | 36 ++++--------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs index 20f5b1a37..0ffd6ffd9 100644 --- a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs +++ b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs @@ -620,16 +620,8 @@ public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vect return; identity.gameObject.transform.position = pos; - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; - - foreach (Player ply in Player.List) - { - ply.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); - } + NetworkServer.UnSpawn(identity.gameObject); + NetworkServer.Spawn(identity.gameObject); } /// @@ -643,16 +635,8 @@ public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vec return; identity.gameObject.transform.localScale = scale; - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; - - foreach (Player ply in Player.List) - { - ply.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); - } + NetworkServer.UnSpawn(identity.gameObject); + NetworkServer.Spawn(identity.gameObject); } /// @@ -788,16 +772,8 @@ public static void EditNetworkObject(NetworkIdentity identity, Action