com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
fix: Parenting does not preserve WorldPositionStays option and other parenting related issues
When parenting and setting the WorldPositionStays to false on the server, clients would not apply the same WorldPositionStays setting because it was not being synchronized. This PR also provides parent child serialization ordering during the initial client synchronization that happens when the connection is approved. MTT-4616
For Visual Validation via Manual Testing:
Use the companion test project PR #2207
Changelog
-
Added: Position, rotation, and scale to the
ParentSyncMessage
which provides users the ability to specify the final values on the server-side whenOnNetworkObjectParentChanged
is invoked just before the message is created (when theTransform
values are applied to the message). -
Fixed: Issue where the
WorldPositionStays
parenting parameter was not being synchronized with clients. -
Fixed: Issue where parented in-scene placed
NetworkObject
s would fail for late joining clients. -
Fixed: Issue where scale was not being synchronized which caused issues with nested parenting and scale when
WorldPositionStays
was true. -
Fixed: Issue with
NetworkTransform.ApplyTransformToNetworkStateWithInfo
where it was not honoring axis sync settings whenNetworkTransformState.IsTeleportingNextFrame
was true. -
Fixed: issue with
NetworkTransform.TryCommitTransformToServer
where it was not honoring theInLocalSpace
setting.
Testing and Documentation
- Includes integration test that validates with and without
WorldPositionStays
. - Includes additional parenting tests (WIP)
- Documentation updates are necessary. (PR-778)
Code looks good... will approve once tests are committed.