diff --git a/Assets/Mirage/Runtime/ServerObjectManager.cs b/Assets/Mirage/Runtime/ServerObjectManager.cs
index ab4b8c26d1..6774a24935 100644
--- a/Assets/Mirage/Runtime/ServerObjectManager.cs
+++ b/Assets/Mirage/Runtime/ServerObjectManager.cs
@@ -739,7 +739,8 @@ public void SpawnVisibleObjects(INetworkPlayer player, bool ignoreHasCharacter,
/// NetworkIdentity to skip when spawning. Can be null
public void SpawnVisibleObjects(INetworkPlayer player, bool ignoreHasCharacter, HashSet skip)
{
- // todo Call player.RemoveAllVisibleObjects() first so that it will send spawn message for objects destroyed in scene change
+ // remove all, so that it will send spawn message for objects destroyed in scene change
+ player.RemoveAllVisibleObjects();
if (!ignoreHasCharacter && !player.HasCharacter)
{
@@ -768,12 +769,12 @@ public void SpawnVisibleObjects(INetworkPlayer player, bool ignoreHasCharacter,
if (skip != null && skip.Contains(identity))
continue;
- if (logger.LogEnabled()) logger.Log($"Checking Observers on server objects name='{identity.name}' netId={identity.NetId} sceneId={identity.SceneId:X}");
+ if (logger.LogEnabled()) logger.Log($"Checking Observers on server objects name='{identity.name}' netId={identity.NetId} sceneId={identity.SceneId:X}");
- var visible = identity.OnCheckObserver(player);
- if (visible)
- {
- identity.AddObserver(player);
+ var visible = identity.OnCheckObserver(player);
+ if (visible)
+ {
+ identity.AddObserver(player);
}
}