You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a custom AOI implementation so it might not be a problem by default if handled appropriately there, but we have an issue where client net ids are removed from NetworkClient.spawned AFTER moving out and back into AOI very quickly. This is happening because you're using GameObject.Destroy here:
Just to make sure I understood this correctly, your AOI can spawn/despawn objects rapidly, and sometimes that causes those objects to be left behind on the client?
Could you check instead of the plain spawned.Remove in NetworkIdentity, adding a check beforehand fixes this?
Something like:
// make sure to only remove if we are the NI in spawned for netId
if (NetworkClient.spawned.TryGetValue(netId, out NetworkIdentity id) && id == this)
{
// if an identity is still in .spawned, remove it too.
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
NetworkClient.spawned.Remove(netId);
}
We have a custom AOI implementation so it might not be a problem by default if handled appropriately there, but we have an issue where client net ids are removed from NetworkClient.spawned AFTER moving out and back into AOI very quickly. This is happening because you're using GameObject.Destroy here:
Mirror/Assets/Mirror/Core/NetworkClient.cs
Line 1739 in ac87583
but you added a fix re scene loading to NetworkIdentity.OnDestroy here:
Mirror/Assets/Mirror/Core/NetworkIdentity.cs
Line 677 in ac87583
If you're very quick you can have the OnDestroy land after respawning the object and you end up with an orphaned clone.
Fix for us seems to be just using DestroyImmediate but I'm not sure if this has any implications for features we're not using.
NOTE - apologies we're not on latest so you may have fixed this by other means, I'll test on latest shortly.
All the best
The text was updated successfully, but these errors were encountered: