com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

fix: Parenting does not preserve WorldPositionStays option and other parenting related issues

Open NoelStephensUnity opened this issue 2 years ago • 1 comments

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 when OnNetworkObjectParentChanged is invoked just before the message is created (when the Transform 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 NetworkObjects 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 when NetworkTransformState.IsTeleportingNextFrame was true.

  • Fixed: issue with NetworkTransform.TryCommitTransformToServer where it was not honoring the InLocalSpace setting.

Testing and Documentation

  • Includes integration test that validates with and without WorldPositionStays.
  • Includes additional parenting tests (WIP)
  • Documentation updates are necessary. (PR-778)

NoelStephensUnity avatar Aug 24 '22 16:08 NoelStephensUnity

Code looks good... will approve once tests are committed.

ShadauxCat avatar Aug 31 '22 20:08 ShadauxCat