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
{{ message }}
Repository navigation
Some NetworkObjects do not despawn (get destroyed) on client while disabled on disconnect #3899
Some NetworkObjects do not despawn (get destroyed) on client while disabled on disconnect. The NetworkObjects stay spawned in client scene even when the host disconnects / client leaves
Reproduce Steps
Spawn and disable a network object on client + host
Disconnect client / host
The NetworkObject stays on client even though the owner is server
Actual Outcome
NetworkObject stays spawned and disabled in client scene when host ends session
Expected Outcome
The GameObject should have been despawned and destroyed
Screenshots
(from client) the host disconnected and the NetworkObjects stayed on hierarchy spawned
Environment
OS: Windows 11
Unity Version: 6000.3.11f1
Netcode Version: 2.10.0
Netcode Commit: ?
Netcode Topology: Host - Client
Additional Context
I can provide more logs if needed, but afaik we just spawn resources in our game and then disable them if they get destroyed (dont despawn for pooling) and then enable them again if the player refreshes the map
Just for sanity, do you mind verifying if DontDestroyWithOwner is false for all of these objects?
Otherwise, is there any chance you can drop your LogLevel down to Developer and share the logs when the host leaves the session? If the host is leaving the session then it should not be possible for the client to see any spawned objects as there shouldn't be a session for them to be spawned in. It definitely looks like might have found an edge case issue here.
Thanks a lot for the quick reply! I checked the prefab and the spawned objects and the DontDestroyWithOwner is set to default value FALSE.
After turning on the developer log level I noticed there MIGHT be some problems happening
I will try to look at all of these and get back if the error still persists. Thanks for the insight
Oooh, that is very strange. It looks like maybe the NetworkManager is ending up destroyed before anything else which is breaking stuff unexpectedly. Do you know if this used to work and is now broken?
Just to add to @EmandM's question: Do you use the UnityEngine.SceneManagement.SceneManager to load something upon disconnecting from a session? If so, when is that being invoked?
Dynamically creating NetworkObjects during runtime is not supported by NGO and will not synchronize properly. Anywhere you are doing this, I would make those actual network prefabs within the editor (while not in play mode) and then spawn instances of those.
Why?
NetworkObject prefabs and/or in-scene placed NetworkObjects will generate a GlobalObjectIdHash value while in the editor and not play mode. This cannot be done during runtime as the clients need to already have the GlobalObjectIdHash on their end to know "what thing should the client create an instance of". Additionally, when creating them dynamically (like the above script) during runtime, the GlobalObjectIdHash value will end up being 0 for every instance.
The rule of thumb is for creating a GameObject with a NetworkObject instance is to create a network prefab or within a scene all within the editor (when not in play mode).
This allowed me to run the host within the editor window and the client within the MPPM virtual client. (I would highly recommend adding some UI to handle this)
I was running Unity 6000.4 and using the most current version of NGO (yet to be released...but will be available very soon).
You can test the above modifications with v2.12.0 or use the soon to be released version by temporarily replacing your manifest.json entry for com.unity.netcode.gameobjects with this:
@Squashi11
We are closing this issue as we were not able to replicate it and have provided a working example of how to accomplish what you were trying to accomplish. If you feel this is still an issue please feel free to re-open it or post additional findings here.
Thanks a lot for your extensive reply and sorry for my inactivity in this thread! This has helped us immensely and we managed to fix all the issues. For the objects not de-spawning issue = we fixed it by updating to the latest version when it came out, so it looked like a fixed bug. For now we have no more issues, thanks a lot for your time on this matter.
Activity
EmandM commentedon Mar 16, 2026
Just for sanity, do you mind verifying if
DontDestroyWithOwnerisfalsefor all of these objects?Otherwise, is there any chance you can drop your LogLevel down to
Developerand share the logs when the host leaves the session? If the host is leaving the session then it should not be possible for the client to see any spawned objects as there shouldn't be a session for them to be spawned in. It definitely looks like might have found an edge case issue here.Squashi11 commentedon Mar 17, 2026
Thanks a lot for the quick reply! I checked the prefab and the spawned objects and the DontDestroyWithOwner is set to default value FALSE.
After turning on the developer log level I noticed there MIGHT be some problems happening
I will try to look at all of these and get back if the error still persists. Thanks for the insight
Squashi11 commentedon Mar 17, 2026
Upon exiting play mode this error occurs numerous times
EmandM commentedon Mar 17, 2026
Oooh, that is very strange. It looks like maybe the
NetworkManageris ending up destroyed before anything else which is breaking stuff unexpectedly. Do you know if this used to work and is now broken?NoelStephensUnity commentedon Mar 17, 2026
Hi @Squashi11,
Just to add to @EmandM's question:
Do you use the UnityEngine.SceneManagement.SceneManager to load something upon disconnecting from a session? If so, when is that being invoked?
22 remaining items
NoelStephensUnity commentedon Jul 16, 2026
@Squashi11
Thank you for submitting your project as that greatly helped me narrow down the underlying issues.
When scene management is disabled
Since your NetworkManager has scene management disabled, in-scene placed NetworkObjects that are not network prefab instances that are registered with a hash override will not get synchronized.
To resolve this issue:
Reference to the setup:

What it should look like when you are done with that entry.

Dynamically spawned NetworkObjects must be network prefabs created in the editor
For some of the other NetworkObjects not being spawned, within your BasePoolManager class there is this method:
Dynamically creating NetworkObjects during runtime is not supported by NGO and will not synchronize properly. Anywhere you are doing this, I would make those actual network prefabs within the editor (while not in play mode) and then spawn instances of those.
Why?
NetworkObject prefabs and/or in-scene placed NetworkObjects will generate a GlobalObjectIdHash value while in the editor and not play mode. This cannot be done during runtime as the clients need to already have the GlobalObjectIdHash on their end to know "what thing should the client create an instance of". Additionally, when creating them dynamically (like the above script) during runtime, the
GlobalObjectIdHashvalue will end up being 0 for every instance.The rule of thumb is for creating a GameObject with a NetworkObject instance is to create a network prefab or within a scene all within the editor (when not in play mode).
How this was tested
Within MainGameLogic.cs:
MainGameLogic.CustommethodThis allowed me to run the host within the editor window and the client within the MPPM virtual client.
(I would highly recommend adding some UI to handle this)
I was running Unity 6000.4 and using the most current version of NGO (yet to be released...but will be available very soon).
You can test the above modifications with v2.12.0 or use the soon to be released version by temporarily replacing your manifest.json entry for com.unity.netcode.gameobjects with this:
Let me know if these findings resolve your issues.
NoelStephensUnity commentedon Aug 13, 2026
@Squashi11
We are closing this issue as we were not able to replicate it and have provided a working example of how to accomplish what you were trying to accomplish. If you feel this is still an issue please feel free to re-open it or post additional findings here.
Squashi11 commentedon Aug 14, 2026
Thanks a lot for your extensive reply and sorry for my inactivity in this thread! This has helped us immensely and we managed to fix all the issues. For the objects not de-spawning issue = we fixed it by updating to the latest version when it came out, so it looked like a fixed bug. For now we have no more issues, thanks a lot for your time on this matter.