-
Notifications
You must be signed in to change notification settings - Fork 136
fix: listening for NetworkObject parent changes to fix stuck ingredients on disconnects [MTT-7103] #136
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
fix: listening for NetworkObject parent changes to fix stuck ingredients on disconnects [MTT-7103] #136
Conversation
LPLafontaineB
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution works, however we still get this warning:
[Netcode] NetworkObject #33 moved to the root because its parent NetworkObject #43 is destroyed
UnityEngine.Debug:LogWarning (object)
Unity.Netcode.NetworkLog:LogWarning (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Logging/NetworkLog.cs:28)
Unity.Netcode.NetworkSpawnManager:OnDespawnObject (Unity.Netcode.NetworkObject,bool) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Spawning/NetworkSpawnManager.cs:843)
Unity.Netcode.NetworkSpawnManager:DespawnObject (Unity.Netcode.NetworkObject,bool) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Spawning/NetworkSpawnManager.cs:667)
Unity.Netcode.NetworkConnectionManager:OnClientDisconnectFromServer (ulong) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Connection/NetworkConnectionManager.cs:780)
Unity.Netcode.NetworkConnectionManager:DisconnectEventHandler (ulong) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Connection/NetworkConnectionManager.cs:369)
Unity.Netcode.NetworkConnectionManager:HandleNetworkEvent (Unity.Netcode.NetworkEvent,ulong,System.ArraySegment1<byte>,single) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Connection/NetworkConnectionManager.cs:264) Unity.Netcode.NetworkTransport:InvokeOnTransportEvent (Unity.Netcode.NetworkEvent,ulong,System.ArraySegment1,single) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Transports/NetworkTransport.cs:49)
Unity.Netcode.Transports.UTP.UnityTransport:ProcessEvent () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Transports/UTP/UnityTransport.cs:883)
Unity.Netcode.Transports.UTP.UnityTransport:Update () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.6.0/Runtime/Transports/UTP/UnityTransport.cs:925)
Maybe deparenting the ingredient in the player character's OnNetworkDespawn would avoid this warning?
That's a good idea. Though I just tried this and the player's OnNetworkDespawn actually comes after this warning. It seems the warning is fired as the object is being despawned, so it's not possible to catch it. |
hmm looking at the logs it seems like OnClientDisconnect might happen before this warning, so we could use that to avoid the warning? But it doesn't seem like a clean solution anyways, maybe we should keep it this way with the warning instead |
Description
PR to address stuck ingredients when clients disconnect. The drop and pickup RPCs have been refactored, and a new class to handle NetworkObject parent changes has been added to Ingredient prefabs.
How to test
Issue Number(s)
MTT-7103
Contribution checklist