Repository navigation
Conversation
…r's handle A client receives the server's scene handle for a scene already loaded on the server. Handles are process-local, so looking it up among the client's scenes can match an unrelated scene (e.g. MovedObjectsHolder) and skip the load, or unload the wrong scene. Follow-up to FirstGearGames#1069. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #1069 (closed for lack of a repro). Still present on 4.7.4 /
main; reproduced on 4.7.2 with Unity 6000.3, a macOS dedicated server build and a standalone client build.What happens
On a dedicated server, a scene stays loaded on the server and connections are moved between scenes with
LoadConnectionScenes/UnloadConnectionScenes(by name,AutomaticallyUnload = false). Going A → B works. Going back B → A, the client never loads A:The server then spawns A's scene objects to a client that doesn't have A. Every time for us; a host, or a server in the Editor, doesn't show it (the handle numbers don't line up).
Why
SceneManager(server side,CanLoadScenefalse) broadcastsnew SceneLookupData(s): the client receives the server's handle for A.CanLoadScene→SceneLookupData.GetScenelooks that handle up first, among the client's scenes.MovedObjectsHolder(made when it unloaded A) had the same number as the server's A, so the client treated A as already loaded and skipped it.The same lookup resolves unloads, so a collision could also unload the wrong client scene.
Fix
GetScenetrusts a handle only in the process that runs the server; a pure client resolves by name.ClientScenesLoadedBroadcast), so the server's handle-based pending-load check still matches.InstanceFinder.IsServerStarted, so it assumes one NetworkManager per process.We've run this patch on 4.7.2: the A → B → A round trip against a dedicated server build went from failing every time to passing every time.
🤖 Generated with Claude Code