Skip to content

Commit

Permalink
fix: #3122 DestroyAllClientObjects now also resets after unspawn hand…
Browse files Browse the repository at this point in the history
…ler was called (#3124)
  • Loading branch information
miwarnec committed Mar 23, 2022
1 parent cca7afd commit 3d6c41a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Assets/Mirror/Runtime/NetworkClient.cs
Expand Up @@ -1433,7 +1433,14 @@ public static void DestroyAllClientObjects()
identity.OnStopClient();

bool wasUnspawned = InvokeUnSpawnHandler(identity.assetId, identity.gameObject);
if (!wasUnspawned)

// unspawned objects should be reset for reuse later.
if (wasUnspawned)
{
identity.Reset();
}
// without unspawn handler, we need to disable/destroy.
else
{
// scene objects are reset and disabled.
// they always stay in the scene, we don't destroy them.
Expand Down

0 comments on commit 3d6c41a

Please sign in to comment.