Repository navigation
fix: only send scene migrations to observers, and spawn a NetworkObject shown after a migration in its authority's scene - #4185
Conversation
…ct shown after a migration in the server's scene ObjectSceneChanged was sent to every connected client, including clients that did not observe the migrated NetworkObjects and had never spawned them, which logged "Trying to synchronize NetworkObjectId but it was not spawned". In client-server mode it is now only sent to clients that observe at least one migrated NetworkObject, and each client is only sent the NetworkObjects it observes. Distributed authority is unchanged. A client that starts observing a NetworkObject with NetworkShow after the NetworkObject migrated into another scene was never sent that migration, and instantiated the NetworkObject in its active scene. The client now moves a spawned NetworkObject into its server-side scene, as it already does for NetworkObjects that are part of its initial synchronization.
Distributed authority still sent a scene migration to every client, so clients that did not observe a migrated NetworkObject logged "Trying to synchronize NetworkObjectId but it was not spawned", and a NetworkObject shown after it migrated spawned in the client's active scene. The owner now only sends a migration to the clients that observe a migrated NetworkObject, as in client-server mode. The CMB service's own copy still includes every migrated NetworkObject, and a migration the DAHost forwards is not filtered again. A NetworkObject a distributed authority client spawns when it is shown is moved into its owner's scene. NetworkObjectSceneMigrationObserverTests now also runs as DAHost.
|
Check the configuration's TOML syntax, permitted settings, and size limit. See the error below. Error message: Configuration content:# This is the configuration for the u-pr bot
# https://github.cds.internal.unity3d.com/unity/u-pr
# For configuration of this file:
# https://developer.portal.internal.unity.com/catalog/default/component/u-pr/docs/configuration/automatic_runs/
[github_app]
handle_pr_actions = ['opened', 'ready_for_review'] # PR events that auto-run pr_commands
pr_commands = ["/harness-review"] # what runs on those events
reviewer_commands = ["/harness-review"] # what runs when @u-pr is added as reviewer
|
There was a problem hiding this comment.
💡 Harness Review
The change filters scene migrations by observer and moves newly shown objects into their authority’s scene, but the filtering leaves a reachable distributed-authority migration unsent to the session-state service.
Reviewed commit b69f17b
🤖 Helpful? 👍/👎
…gration Only the session owner sends the CMB service its own copy of a migration; a client that is not the session owner does not tell the service about objects only it observes.
|
@u-pr please review again, your comment has been addressed. |
|
Thanks for the clarification and the updated comment in commit The explanation holds: because a non-session-owner DA client does not inform the CMB service about objects only it observes ( The updated comment in Everything looks good. 🤖 Helpful? 👍/👎 |
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## develop-2.0.0 #4185 +/- ##
=================================================
+ Coverage 74.16% 74.21% +0.04%
=================================================
Files 172 172
Lines 28144 28200 +56
=================================================
+ Hits 20874 20929 +55
- Misses 7270 7271 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Added method to disable CMB service for Rust server compatibility.
Purpose of this PR
This PR fixes two scene migration issues for NetworkObjects that are hidden from some clients: those clients no longer log an error when the NetworkObject moves to another scene, and they spawn it in the authority's scene when it is shown to them later. Both fixes apply in client-server and distributed authority modes.
PR Scope:
SceneEventType.ObjectSceneChanged) was sent to every connected client, including clients that did not observe the migrated NetworkObject and logged "Trying to synchronize NetworkObjectId but it was not spawned". It is now only sent to the clients that observe at least one migrated NetworkObject, and each client is only sent the NetworkObjects it observes. In distributed authority mode the owner applies the same filter; the CMB service is still sent every migrated NetworkObject, since it keeps the session state, and a migration the DAHost forwards is not filtered again.NetworkShowafter it migrated into another scene, while hidden from that client, was instantiated in the client's active scene, since the client was never sent that migration. The client now moves the spawned NetworkObject into its server-side scene (its owner's scene in distributed authority mode), as it already does during its initial synchronization (NetworkSceneManager.SynchronizeNetworkObjectScene).New
NetworkObjectSceneMigrationObserverTests(4 tests,Host/DAHost/Server) cover both fixes, and a late joining client's synchronization of a NetworkObject that is not in the active scene.Out of this PR's scope:
Jira ticket
TBD
Changelog
NetworkObjectinto another scene made the clients that did not observe it log "Trying to synchronize NetworkObjectId but it was not spawned". The scene migration is now only sent to the clients that observe theNetworkObject.NetworkObjectthat was moved into another scene while hidden from a client spawned in that client's active scene when it was shown withNetworkShow, instead of the scene it is in on the server.Documentation
Testing & QA (How your changes can be verified during release Playtest)
Headless PlayMode runs on 6000.5.3f1.
Unity.Netcode.RuntimeTestsNetworkObjectSceneMigrationObserverTestsFunctional 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?Up-port
These fixes are part of #4176 on
develop-3.x.x.Backports
Not needed.
🤖 Generated with Claude Code