Repository navigation
fix: respawn hybrid NetworkObject on NetworkShow after NetworkHide - #4236
Merged
Merged
Conversation
On a client, despawning a hybrid NetworkObject leaves its GameObject to N4E, and NetworkHide does not make the ghost irrelevant, so the instance survives. Its pending ghost spawn entry was consumed on first spawn, so the CreateObjectMessage sent by NetworkShow waited for a ghost spawn that never came. The client now re-registers the surviving instance as a pending ghost spawn; NetworkObject.OnDestroy already drops the entry if N4E later destroys it.
Merged
1 of 6 tasks
Codecov ReportAttention: Patch coverage is @@ Coverage Diff @@
## develop-3.x.x #4236 +/- ##
=================================================
- Coverage 76.91% 76.84% -0.07%
=================================================
Files 159 159
Lines 27603 27624 +21
=================================================
- Hits 21230 21229 -1
- Misses 6373 6395 +22
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes
|
The despawn on NetworkHide marks the instance and its NetworkBehaviours as destroying, which stuck once the instance survived, so AttachableBehaviour could no longer detach on the client. The surviving instance now clears that flag. A retained child that NGO parented is no longer a root GameObject, so NetworkShow threw in MoveGameObjectToScene. Only root instances are moved into the active scene.
NoelStephensUnity
enabled auto-merge (squash)
October 30, 2026 14:15
EmandM
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
A hybrid (NetworkObject + GhostObject) instance hidden from a client with
NetworkHideand then shown again withNetworkShowis now respawned on that client, under both client-server topologies (UnifiedHost and UnifiedServer). Before this, theCreateObjectMessagesent byNetworkShowwaited for a ghost spawn that never arrived and the instance was never respawned.On a client, despawning a hybrid NetworkObject leaves its GameObject to N4E, and
NetworkHidedoes not make the ghost irrelevant, so the instance survives. Its pending ghost spawn entry was consumed on the first spawn, so the show had nothing to match against. The client now re-registers the surviving instance as a pending ghost spawn when it is despawned;NetworkObject.OnDestroyalready drops that entry if N4E later destroys the ghost.This also unblocks the Unified fixtures of
NetworkListTests.NetworkShowWithThrottledPendingChangesin #4216.PR Scope:
NetworkSpawnManager: a client re-registers a despawned hybrid instance as a pending ghost spawn and clears its destroying flag, so itsNetworkBehaviours (e.g.AttachableBehaviourdetach) work again once shown.GhostSpawnManager: only a root instance is moved into the active scene on spawn, so a hidden child parented by NGO can be shown again.HybridNetworkShowHideTests(UnifiedHost and UnifiedServer): hide/show cycles respawn the same instance, a parented child keeps its parent, attach/detach works after a show, and despawning while hidden releases the pending entry.Out of scope:
Jira ticket
N/A
Changelog
None (hybrid mode is experimental).
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?If any boxes above are checked the QA team will be automatically added as a PR reviewer.
Up-port
N/A (hybrid mode exists on develop-3.x.x only).
Backports
N/A (hybrid mode exists on develop-3.x.x only).