Skip to content

Commit 62a0f1c

Browse files
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.
1 parent 2d8e1cc commit 62a0f1c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,11 @@ private bool CheckForStateChange(ref NetworkTransformState networkState, ref Tra
21492149
}
21502150
isDirty = true;
21512151

2152+
// If we are already teleporting preserve the teleport flag.
2153+
// If we don't have SwitchTransformSpaceWhenParented set or we are synchronizing,
2154+
// then set the teleport flag.
2155+
networkState.IsTeleportingNextFrame |= !SwitchTransformSpaceWhenParented || isSynchronization;
2156+
21522157
// Otherwise, if SwitchTransformSpaceWhenParented is set we force a full state update.
21532158
// If interpolation is enabled, then any non-authority instance will update any pending
21542159
// buffered values to the correct world or local space values.

0 commit comments

Comments
 (0)