Skip to content

Commit e85b487

Browse files
test
Check on the receiving side of the `ReferenceTeleportRpc` call that only the motion authority applies the teleport.
1 parent 773b6c0 commit e85b487

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkTransformOrderOfOperations.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,8 @@ public class ReferenceRpcHelper : NetworkBehaviour
10651065
public void ReferenceTeleportRpc(NetworkBehaviourReference networkBehaviourReference, Vector3 position, Quaternion rotation, RpcParams rpcParams = default)
10661066
{
10671067
networkBehaviourReference.TryGet<SpawnSequenceController>(out var spawnSequenceController);
1068-
if (spawnSequenceController != null)
1068+
// This validation assumes that user script will broadcast an update to everyone but only the motion authority will apply the update.
1069+
if (spawnSequenceController != null && spawnSequenceController.CanCommitToTransform)
10691070
{
10701071
spawnSequenceController.Log($"[{nameof(ReferenceRpcHelper)}][{nameof(ReferenceTeleportRpc)}] Invoked on client-{NetworkManager.LocalClientId}.");
10711072
spawnSequenceController.SetState(posIn: position, rotIn: rotation, teleportDisabled: false);

0 commit comments

Comments
 (0)