Skip to content

fix: [Backport] rejected parent change restores the original pose - #4203

Open
NoelStephensUnity wants to merge 2 commits into
develop-2.0.0from
fix/parent-revert-restores-pose-2.0.0
Open

NoelStephensUnity wants to merge 2 commits into
develop-2.0.0from
fix/parent-revert-restores-pose-2.0.0

Conversation

@NoelStephensUnity

Copy link
Copy Markdown
Member

Purpose of this PR

A rejected NGO parent change now restores the object's original position, rotation and scale along with its parent.

When NGO rejects a parent change (for example a client without parenting authority, an unspawned NetworkObject, or a parent without a NetworkObject), it reverted the parent by assigning transform.parent, which keeps the world position. A change made with worldPositionStays disabled had already moved the object, so the parent was restored but the object kept its moved position. The position, rotation and scale from before the change are now captured in OnBeforeTransformParentChanged and restored along with the parent.

PR Scope:

  • NetworkObject: captures the local transform prior to a parent change and restores it when the change is reverted.
  • Tests: NetworkObjectParentRevertTests.

Jira ticket

N/A

Changelog

  • Fixed: Issue where a rejected parent change, for example one made by a client without parenting authority, restored the NetworkObject's parent but left it at the moved position when the change was made with worldPositionStays disabled. The original position, rotation and scale are now restored.

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?

Up-port

Not applicable. The fix is already on develop-3.x.x in #4202.

Backports

Backport of the parent revert fix from #4202.

NGO reverted a rejected parent change by assigning transform.parent, which keeps the world
position. A change made with worldPositionStays disabled had already moved the object, so the
parent was restored but the object kept its moved position. The local transform is now captured
in OnBeforeTransformParentChanged and restored along with the parent.

Port of the parent revert fix from #4202.
@NoelStephensUnity
NoelStephensUnity requested a review from a team as a code owner October 20, 2026 18:09

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Harness Review

Ship it

The change restores the cached parent and the local pose after rejected parenting changes. I examined all rejection paths, callback guards, parent-cache initialization, and the new tests’ authority setup; no actionable issues stood out.

Reviewed commit 894a24c

🤖 Helpful? 👍/👎

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.

1 participant