Skip to content

Commit 358d3cf

Browse files
test-fix
Moving the motion authority check within the check to assure the SpawnSequenceController NetworkBehaviourReference is valid.
1 parent e85b487 commit 358d3cf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,14 @@ 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-
// 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)
1068+
if (spawnSequenceController != null)
10701069
{
1071-
spawnSequenceController.Log($"[{nameof(ReferenceRpcHelper)}][{nameof(ReferenceTeleportRpc)}] Invoked on client-{NetworkManager.LocalClientId}.");
1072-
spawnSequenceController.SetState(posIn: position, rotIn: rotation, teleportDisabled: false);
1070+
// This validation assumes that user script will broadcast an update to everyone but only the motion authority will apply the update.
1071+
if (spawnSequenceController.CanCommitToTransform)
1072+
{
1073+
spawnSequenceController.Log($"[{nameof(ReferenceRpcHelper)}][{nameof(ReferenceTeleportRpc)}] Invoked on client-{NetworkManager.LocalClientId}.");
1074+
spawnSequenceController.SetState(posIn: position, rotIn: rotation, teleportDisabled: false);
1075+
}
10731076
}
10741077
else
10751078
{

0 commit comments

Comments
 (0)