Commit 47ae1ea
fix: networktransform SwitchTransformSpaceWhenParented forces updates when InLocalSpace is true (#3664)
* fix
Assure that the local InLocalSpace field is updated to match the parented status.
* fix
Reset IsTeleporting and ExplicitSet after invoking OnAuthorityPushTransformState so these values are preserved for user script.
Automatically adjust InLocalSpace when spawning a NeworkObject based on the NetworkObject's current parented status when SwitchTransformSpaceWhenParented is enabled.
* update
Invoking the OnAuthorityPushTransformState and OnNetworkTransformStateUpdated when synchronizing in order to provide users with the NetworkTransformState used to synchronize a NetworkTransform when first spawned.
* update
Revert moving where IsTeleportingNextFrame and ExplicitSet are reset.
Add WasTeleported to NetworkTransformState in order to preserve whether the pushed state was teleported or not.
* update
Adding documentation updates.
* update
XML API update
* Doc pass on NetworkTransform additions
* fix
NetworkSpawnManager:
Relative to spawning only, process deferred messages after post spawn.
NetworkTransform:
Synchronize the SwitchTransformSpaceWhenParented flag when it changes on the authority side.
Perform an early check in CheckForStateChange for changes to SwitchTransformSpaceWhenParented.
Apply changes to SwitchTransformSpaceWhenParented when processing a state update on non-authority instance.
* Update com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs
Co-authored-by: Amy Reeve <[email protected]>
* Update com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs
Co-authored-by: Amy Reeve <[email protected]>
* Update com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs
Co-authored-by: Amy Reeve <[email protected]>
* Update com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs
Co-authored-by: Amy Reeve <[email protected]>
* refactor
A complete refactoring of how parenting is handled when NetworkTransform.SwitchTransformSpaceWhenParented is enabled to provide a complete 1:1 match of (n) back-to-back parenting actions and/or many parenting actions that occur over several frames. This preserves the order of operations, sends 1 full state update plus an added parenting directive per action immediately, and then upon receiving the non-authority instances will apply the parenting, transform the local values and interpolators' queued entries between transform spaces (world to local, local to world, or local to local).
* style
Standards/style fix.
* style - PVP
More hidden white spaces...
* update
Removing one line space
* update
Adding change log entry.
* update
Check if writing as binary resolves the CRLF issue.
* update
Reverting last change.
Removing a single line of code.
* update
Migrating all NetworkTransform serialization into the NetworkTransformMessage.
Removing legacy observers for the NetworkTransform.
* upate
Increment count after check when iterating through observers.
* style
remove whitespaces.
* test
Add a test to validate this PR.
* Apply suggestions from code review
Co-authored-by: Amy Reeve <[email protected]>
* doc: update
Adjusting based on the PR's recent updates.
Refactoring the physics section.
Moved the NetworkRigidbody content out of physics and into a new NetworkRigidbody section under componetns.
Moved physics up to the components layer.
Did a large update to the physics documentation and provided an additional walk through of how to "parent" physics bodies using attachables.
* doc: style
Adding one suggested change I left out.
* style - PVP
Fixing trailing spaces.
* update
Further clarifying the update to NetworkObject.SpawnWithOwnership
* fix
If half float precision is enabled, then update the current half float position state after transforming the current position due to a change in the NetworkObject's status.
* test and style
Updating the SwitchTransformSpaceWhenParented test to validate using various NetworkTransform configurations (i.e. half precision, quaternion, quaternion compressed) while also parenting with world position stays enabled and disabled.
Removing trailing space in recent documentation update.
* update
adding additional changelog entries.
* update
reflecting the current version of this file from main branch.
* update
Try this one more time.
* update
Making NetworkTransformState.SwitchTransformSpaceWhenParented internal as it doesn't really need to be public for its use case.
* Docs pass on new content
* Reinstating note
* Updating landing page
* refactor
Relatively large change:
- Preserving order of operations by making the default network delivery be reliable fragmented sequenced with the exception of named, unnamed, and any message types adjusted explicitly by user code to use a different network delivery method.
- Adjusted parenting directive to allow the server to force a parenting directive on a NetworkTransform it does not have the motion authority over.
- The NetworkObjects to show now will be also processed in-between ticks to preserve order of operations.
- NetworkObjects pending to be shown on the same frame as the tick update will still be processed during the tick update.
* update
Left out the half precision adjustment in the server-side edge case for back-to-back changes.
* update
Adding additional change log entries.
* update
Minor version increment.
* fix
Fix the issue where a user can still set InLocalSpace when SwitchTransformSpaceWhenParented is enabled.
* fix
Fix issue where client owner authority NetworkTransform would not set the right IsParented status when sending a parenting directive.
* fix
Assure MessageDelivery is initialized whether in editor or stand alone.
* refactor
Include any pending dirty NetworkVariable updates just prior to sending the Show/CreateObjectMessage.
* style - PVP
Removing un-used comment line to avoid PVP-124-2
* refactor
Better organizing NetworkBehaviourUpdater's methods to be a bit more modular in order to better handle how we handle force synchronizing NetworkVariables when showing a NetworkObject.
Mobed all of that logic from NetworkBehaviourUpdater to the late update section in NetworkManager.
* fix
Needed to check the inverse of whether either are true to determine if we should exit early in the NetworkBehaviourUpdater.
* fix
Removing debug log entry that is was added for troubleshooting an issue while making changes in this PR.
Not throwing an exception when getting a message type by actual message type (only used in DA codec tests). Instead, it now returns the default reliable fragmented sequenced.
* fix
Try this MessageDelivery fix for the codec test one more time.
* refactor and fix
Removed the extra byte per updated from the parenting directive and added it as a flag.
Fixed spawn no observers, show, and then parent issue where the initial parenting during spawn was causing issues with a back-to-back parenting message.
* fix
Only invoke OnDestroy if Singleton is not null during the application quit.
Resolved the issue where a server spawning an object with ownership that then changes the parent in the same frame with a NetworkTransform that has SwitchTransformSpaceWhenParented enabled was not applying the parenting directive (being sent to all observers) locally.
* fix
Regressed a previous fix when resolving the most current issue where generating a parent directive should only apply the parenting directive if it is the server and not the motion authority (whether local or world) and to assure if we are the motion authority we still set the m_PreviousParent in the event ownership changes and the NetworkTransform is using an owner authority motion model.
* update
Minor adjustment after merge.
Don't invoke NetworkManager.OnDestroy unless the singleton is null and the current instance is not listening.
* fix
If we suddenly stopped and trying to update non-existent NetworkTransform instances, then just reset the NetworkTransformTickRegistration system.
* fix
Allow NetworkObjects to run through the despawn process if they are destroyed by something like the UnityEngine SceneManager when unloading a scene. Added validation check against the NetworkObject's GameObject's scene (IsValid) and whether the scene is loaded or not to determine if an error message should be logged or if it is just being destroyed due to the scene being unloaded (abrupt unloading like exiting play mode while in a session).
* fix
If a NetworkTransformMessage is received while in the middle of shutting down, then do not attempt to process it.
* fix
Changing #3687 adjustment to use the version of SpawnNetworkObjectLocally that accepts a SceneObject which doesn't invoke pre-spawn but does invoke post spawn and processes deferred messages.
These were moved in this PR to assure post spawn was invoked after the object was 100% done locally spawning and as a last step process any deferred messages targeting this object.
* test
Made a few adjustments to this test in order to debug, added additional logging, and marked this test as needing to be updated (and extended).
* style
removing whitespaces
* test - fix
Validating clients had initialized was some how was encapsulated within a verbose debug check. Not sure why this was passing before other than certain messages might have always been processed out of order before...?
* fix and update
Removing the previously removed post spawn invocation from the common spawn method (missed when merging).
Renaming the local spawn methods to reflect the context of the local spawn (i.e. authority is the first to spawn and then notify where non-authority is invoked by the authority's CreateObjectMessage). It will help keep the context clear (possible area to merge into one with a flag to determine if it is an authority or non-authority spawn action).
* test
Minor adjustments to the test that caught this issue.
Added logs and condensed NetworkUpdate.
* style
insert a whitespace
* style - PVP
Removing whitespace at the end of the comment
* refactor
Minor performance gain by using a pre-defined static network delivery that is registered by message type within MessageDelivery.
* fix
Removing using directive.
Reverting changes to NetworkVariableCollectionsTests
* update
Minor code clean up with a handful of additional comments.
* style
Adjusting internal comments for clarity purposes.
* refactor
This includes a different approach to handling buffered linear interpolation conversion when switching transform space.
* update
Making parent internal.
* update
Removing additional script not used.
* refactor
Noticed an issue with the world space approach and rotating platforms (parents).
This is a refactor of the same kind of approach (i.e. interpolator handles transform space updates) with the addition of tracking each measurement's parent, handling any transform space conversion if the current parent is different from the measurement's parent, and just keeping everything transform space relative.
* fix
Set the target parent when initializing.
Added additional checks when getting the current interpolated value to handle the interpolation frames between the current and next measurement states.
* fix
This resolves the issue where there was a de-synch between converting transform spaces.
* update
Removing left over debug script.
* fix
This resolves the broken half float issue.
* fix
Fixing issue with synch when SwitchTransformSpaceWhenParented is disabled.
* fix
Allow a full teleport when using SwitchTransformSpaceWhenParented.
* fix - refactor
This refactors the previous "fix" to preserve the teleport flag but also keeps the original logic which is needed for when SwitchTransformSpaceWhenParented is disabled.
* test - wip
This includes a more modular framework for generating order of operation sequences in order to create a wide range of tests that validate specific order of operation actions are processed and applied on the non-authority instances as they were on the authority instance.
* test
Updated the order of operations test to include 10 of the 11 spawn sequence ordering tests.
Added `NetcodeIntegrationTest.SpawnObjectInstance` that allows you to create an instance of a prefab and pass the instance in to be spawned through the normal integration test spawn process.
* style
Removing single white space after an (internal) comment...
* style
removing more whitespace.
* Test-update
Some general clean up and separating areas of the NetworkTransformOrderOfOperations by region to help with navigating through the different parts.
* test
Adding the 11th test to the order of operations test.
* update
Adding missing change log entry.
* test
Check on the receiving side of the `ReferenceTeleportRpc` call that only the motion authority applies the teleport.
* test-fix
Moving the motion authority check within the check to assure the SpawnSequenceController NetworkBehaviourReference is valid.
* doc
Updated some XML API documentation and corrected a typo in a comment.
---------
Co-authored-by: Amy Reeve <[email protected]>1 parent bcb73cd commit 47ae1ea
File tree
60 files changed
+3382
-653
lines changed- Tools/scripts/Utils
- com.unity.netcode.gameobjects
- Documentation~
- advanced-topics
- components
- core
- helper
- images
- attachable
- networktransform
- Editor
- Runtime
- Components
- Interpolator
- Connection
- Core
- Logging
- Messaging
- Messages
- NetworkVariable
- SceneManagement
- Spawning
- Timing
- Tests/Runtime
- DistributedAuthority
- NetworkTransform
- NetworkVariable
- TestHelpers
- testproject/Assets/Tests/Runtime
- Support
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
60 files changed
+3382
-653
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
30 | | - | |
31 | | - | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
Lines changed: 428 additions & 32 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | | - | |
| 169 | + | |
| 170 | + | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
0 commit comments