Skip to content

Commit

Permalink
fix: fixing scene objects not being removed from NetworkWorld
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Jun 13, 2023
1 parent 758f51d commit 546dd3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Assets/Mirage/Runtime/ClientObjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ private void ThrowIfExists(int prefabHash, NetworkIdentity newPrefab = null)

private void UnSpawn(NetworkIdentity identity)
{
// have to store netid, so we can remove it from world, this is because NetworkReset will clear it
var netId = identity.NetId;

logger.Assert(!_client.IsLocalClient, "UnSpawn should not be called in host mode");
// it is useful to remove authority when destroying the object
// this can be useful to clean up stuff after a local player is destroyed
Expand All @@ -437,7 +440,7 @@ private void UnSpawn(NetworkIdentity identity)
spawnableObjects[identity.SceneId] = identity;
}

_client.World.RemoveIdentity(identity);
_client.World.RemoveIdentity(netId);
}

/// <summary>
Expand Down

0 comments on commit 546dd3c

Please sign in to comment.