Skip to content

fix: mixed authority nested NetworkTransform stops updating non-authority nested NetworkTransforms - #4169

Open
NoelStephensUnity wants to merge 8 commits into
develop-2.0.0from
fix/mixed-authority-nested-transform-updates
Open

NoelStephensUnity wants to merge 8 commits into
develop-2.0.0from
fix/mixed-authority-nested-transform-updates

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Purpose of this PR

This resolves the issue with mixed authority nested NetworkTransform instances can stop child/nested NetworkTransform instances from updating due to a parent (root or otherwise) NetworkTransform that is the authority instance will remove the NetworkObject completely from the non-authority update group causing non-authority instances to never update their state (interpolating or not).

fix: #4159

Jira ticket

UUM-153570

Changelog

  • Fixed: issue with mixed authority nested NetworkTransform instances can stop child/nested NetworkTransform instances from updating due to a parent (root or otherwise) NetworkTransform that is the authority instance will remove the NetworkObject completely from the non-authority update group causing non-authority instances to never update their state (interpolating or not) on the authority side.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does 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

Requires an up-port.

Backports

No back-port required.

Fixing issue where a `NetworkObject` with nested `NetworkTransform` components using different `NetworkTransform.AuthorityMode` settings stop updating non-authority instances, because the first authority instance removes the entire `NetworkObject` from the update registration.
The tests that validate this fix.
Adding changelog entry
@NoelStephensUnity
NoelStephensUnity marked this pull request as ready for review September 24, 2026 15:44
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code owner September 24, 2026 15:44
@u-pr

u-pr Bot commented Sep 24, 2026

Copy link
Copy Markdown

⚠️ Some settings were ignored in '.pr_agent.toml (repository root)' repo settings

Check the configuration's TOML syntax, permitted settings, and size limit. See the error below.


Error message:
Ignored prohibited settings: github_app.handle_pr_actions. Permitted settings were applied.

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

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

LGTM

The mixed-authority registration fix works for transforms sharing an update scheduler, but mishandles nested transforms split between frame and physics updates.

Reviewed commit ff196a3

🤖 Helpful? 👍/👎

Updating comments for clarity
Addressing the u-pr bot's findings.
Adding a test to validate the, now fixed, gap u-pr bot found.
@NoelStephensUnity

Copy link
Copy Markdown
Member Author

@u-pr please review again

@u-pr

u-pr Bot commented Sep 24, 2026

Copy link
Copy Markdown

Review Summary

The latest updates cleanly address the previous feedback:

  1. Scheduler Awareness in HasNonAuthorityNetworkTransform:

    • Accepting forUpdate and filtering out instances configured for a different update stage (forUpdate == networkTransform.m_UseRigidbodyForMotion) ensures registration checks in InternalInitialization only consider transforms operating in the same scheduler (standard update vs. fixed update).
    • This prevents authoritative components from prematurely unregistering a NetworkObject that still contains non-authoritative transforms needing the same update loop.
  2. Integration Test Coverage:

    • Parameterizing NetworkTransformMixedAuthorityTests across host/server and authority mode permutations provides thorough validation for nested synchronization.
    • The new NetworkTransformMixedMotionModelTests confirms that update registration follows the motion model across ownership transfers.

A minor suggestion was left inline regarding an initial baseline assertion in UpdateRegistrationFollowsMotionModel. Overall, the implementation looks solid.

🤖 Helpful? 👍/👎

Applying u-pr's suggestion to this test.
@codecov-github-com

codecov-github-com Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

@@                Coverage Diff                @@
##           develop-2.0.0    #4169      +/-   ##
=================================================
+ Coverage          74.10%   74.14%   +0.03%     
=================================================
  Files                172      172              
  Lines              28127    28144      +17     
=================================================
+ Hits               20844    20867      +23     
+ Misses              7283     7277       -6     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 73.74% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...gameobjects/Runtime/Components/NetworkTransform.cs 89.14% <100.00%> (+0.35%) ⬆️
Components Coverage Δ
com.unity.netcode.gameobjects 74.14% <100.00%> (+0.03%) ⬆️

ℹ️ Need help interpreting these results?

@EmandM EmandM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, mostly just worried about the number of tests added

Comment on lines +11 to +14
[TestFixture(HostOrServer.Host, NetworkTransform.AuthorityModes.Server)]
[TestFixture(HostOrServer.Host, NetworkTransform.AuthorityModes.Owner)]
[TestFixture(HostOrServer.Server, NetworkTransform.AuthorityModes.Server)]
[TestFixture(HostOrServer.Server, NetworkTransform.AuthorityModes.Owner)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both host and server tests here? Seems overkill maybe?

@NoelStephensUnity NoelStephensUnity Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into this.

private void MovePlayers()
{
foreach (var networkManager in m_NetworkManagers)
foreach (var networkManager in m_ClientNetworkManagers)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we only want the client managers rather than all managers?

@NoelStephensUnity NoelStephensUnity Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing an alternate approach for this.
This was specific to the issue being resolved which only occurs with a dedicated server (i.e. has no client).

Comment on lines +50 to +53
private NetworkObject GetAuthorityInstance(NetworkManager player, NetworkTransform.AuthorityModes authorityMode)
{
var authority = authorityMode == NetworkTransform.AuthorityModes.Server ? m_ServerNetworkManager : player;
return authority.SpawnManager.SpawnedObjects[player.LocalClient.PlayerObject.NetworkObjectId];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth moving a function like this down into the base NetcodeIntegrationTest. A GetManagersInstance or something like that.

@NoelStephensUnity NoelStephensUnity Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed it belongs in the base. Moving it there.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants