fix: #3308 scene change NetworkClient.owned null entry. NetworkIdentity.OnDestroy now removes from owned. (#3325)

This commit is contained in:
mischa 2022-12-30 18:02:34 +01:00 committed by GitHub
parent 17c5a6c956
commit 100847cc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -629,6 +629,20 @@ void OnDestroy()
if (NetworkClient.localPlayer == this)
NetworkClient.localPlayer = null;
}
if (isClient)
{
// ServerChangeScene doesn't send destroy messages.
// some identities may persist in DDOL.
// some are destroyed by scene change.
// if an identity is still in .owned, remove it.
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3308
if (NetworkClient.connection != null &&
NetworkClient.connection.owned.Contains(this))
{
NetworkClient.connection.owned.Remove(this);
}
}
}
internal void OnStartServer()