fix: server not tracking scene handles for pre-loaded scenes - #4145
Merged
NoelStephensUnity merged 5 commits intoAug 28, 2026
Merged
Conversation
Scenes that were already loaded when a session starts were added to ScenesLoaded but never to the server-to-client scene handle tables, so UnloadScene passed its ScenesLoaded check and then failed inside RemoveServerClientSceneHandle. The scene unloaded on every peer, but an error was logged and the ScenesLoaded entry was never removed. The client-server branch of the NetworkSceneManager constructor now registers those scenes the same way InitializeScenesLoaded does for distributed authority. NetcodeIntegrationTestHelpers registered the test runner scene in ServerSceneHandleToClientSceneHandle unconditionally, which now collides with the constructor already having added it, so that add is guarded.
There was a problem hiding this comment.
💡 Harness Review
The preload initialization now establishes the complete bidirectional handle state required by the existing unload lifecycle, while the test helper avoids re-registering the runner scene. I examined the constructor guard, mapping add/remove semantics, client synchronization paths, and the added regression test; no actionable defects were identified.
Reviewed commit fe16590
🤖 Helpful? 👍/👎
This was referenced Aug 26, 2026
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop-2.0.0 #4145 +/- ##
=================================================
- Coverage 73.95% 73.91% -0.04%
=================================================
Files 172 172
Lines 28105 28105
=================================================
- Hits 20785 20775 -10
- Misses 7320 7330 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes
|
…es-for-pre-loaded-scenes
NoelStephensUnity
enabled auto-merge (squash)
August 27, 2026 15:22
EmandM
reviewed
Aug 27, 2026
EmandM
left a comment
Member
There was a problem hiding this comment.
Looks good! Just one tiny comment
…eIntegrationTestHelpers.cs Co-authored-by: Emma <emma.mcmillan@unity3d.com>
EmandM
approved these changes
Aug 27, 2026
…es-for-pre-loaded-scenes
NoelStephensUnity
deleted the
fix/server-not-tracking-scene-handles-for-pre-loaded-scenes
branch
August 28, 2026 18:44
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
Scenes that were already loaded when a session starts were added to ScenesLoaded but never to the server-to-client scene handle tables, so UnloadScene passed its ScenesLoaded check and then failed inside RemoveServerClientSceneHandle. The scene unloaded on every peer, but an error was logged and the ScenesLoaded entry was never removed.
The client-server branch of the NetworkSceneManager constructor now registers those scenes the same way InitializeScenesLoaded does for distributed authority.
NetcodeIntegrationTestHelpers registered the test runner scene in ServerSceneHandleToClientSceneHandle unconditionally, which now collides with the constructor already having added it, so that add is guarded.
fix: #4140
Jira ticket
(Needs ticket)
Changelog
NetworkSceneManager.UnloadSceneto log an error and leave the scene registered as loaded even though it unloaded on all peers.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
Up-port: #4146
Requires up-port.
Backports
No backport required.