-
-
Notifications
You must be signed in to change notification settings - Fork 782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AOI issue - NetworkClient.DestroyObject vs NetworkIdentity.OnDestroy #3785
Comments
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?
|
also, any chance that we can reproduce this with one of the mirror demos? |
took another look at this. it makes sense, this is what most likely happens:
|
fixed. thanks for report @joshbayley , this was an interesting one! |
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: