fix: NetworkIdentity.OnDestroy cyclic memory leak

This commit is contained in:
mischa 2024-09-11 22:22:46 +02:00
parent d0f7dbdb20
commit 6da8ec80a3

View File

@ -682,6 +682,11 @@ void OnDestroy()
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324 // fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
NetworkClient.spawned.Remove(netId); NetworkClient.spawned.Remove(netId);
} }
// workaround for cyclid NI<->NB reference causing memory leaks
// after Destroy. [Credits: BigBoxVR/R.S.]
// TODO report this to Unity!
this.NetworkBehaviours = null;
} }
internal void OnStartServer() internal void OnStartServer()