Repository navigation
fix: [Backport] rejected parent change restores the original pose - #4203
Open
NoelStephensUnity wants to merge 2 commits into
Open
NoelStephensUnity wants to merge 2 commits into
NoelStephensUnity wants to merge 2 commits into
Conversation
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.
Contributor
There was a problem hiding this comment.
💡 Harness Review
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
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.
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 aNetworkObject), it reverted the parent by assigningtransform.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 inOnBeforeTransformParentChangedand 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.NetworkObjectParentRevertTests.Jira ticket
N/A
Changelog
NetworkObject's parent but left it at the moved position when the change was made withworldPositionStaysdisabled. The original position, rotation and scale are now restored.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?Up-port
Not applicable. The fix is already on develop-3.x.x in #4202.
Backports
Backport of the parent revert fix from #4202.