Repository navigation
Conversation
|
|
||
| if (isSessionOwner && NetworkConfig.EnableSceneManagement) | ||
| { | ||
| SceneManager.InitializeScenesLoaded(); |
There was a problem hiding this comment.
Late joining can still fail on a promoted CMB owner when a locally loaded additive scene's handle collides with an existing shared handle. With ServerSceneHandleToClientSceneHandle[100] = 200, another local scene can have handle 100, because Unity scene handles are client-local. InitializeScenesLoaded passes 100 as both handles, so UpdateServerClientSceneHandle returns before adding the missing reverse mapping. AddSceneToClientSynchronization then indexes that missing entry and throws KeyNotFoundException. Reuse existing client-to-server mappings during initialization. Assign an unused shared handle when registering a new scene.
🤖 Helpful? 👍/👎
| AssertOnTimeout("Session owner promotion failed!"); | ||
|
|
||
| // Connect a late-joining client to verify the new session owner handles the previously unregistered scene. | ||
| yield return CreateAndStartNewClient(); |
There was a problem hiding this comment.
This regression test can pass even if the promoted owner never registers EmptyScene. AddActiveSceneToClientSynchronization now warns and omits an unregistered active scene instead of throwing. The test managers share Unity's scene hierarchy, so EmptyScene is already loaded and active for the late joiner. CreateAndStartNewClient checks connection and player clones, which can complete without synchronizing that scene. Assert that the promoted owner registers EmptyScene. Assert that the late joiner receives the scene's shared-handle mapping.
🤖 Helpful? 👍/👎
Purpose of this PR
Backport of #4214
Currently, when a client starts the session as a DA session owner their NetworkSceneManger initializes all the existing loaded scenes so they can correctly synchronize incoming clients.
This PR ensures that clients promoted to session owner mid-session also initialize their existing loading scenes.
This fixes an error where an active scene that was loaded before the game started would break synchronization on late-joining clients after a new session owner was promoted.
Jira ticket
UUM-154485
Changelog
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
This is a backport of #4214
Backports
n/a