diff --git a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs index e6127e83b..e752c2020 100644 --- a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs +++ b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs @@ -378,6 +378,8 @@ public virtual void ResetState() public virtual void Reset() { ResetState(); + // default to ClientToServer so this works immediately for users + syncDirection = SyncDirection.ClientToServer; } protected virtual void OnEnable() diff --git a/Assets/Mirror/Tests/Editor/NetworkTransform/NetworkTransform2kTests.cs b/Assets/Mirror/Tests/Editor/NetworkTransform/NetworkTransform2kTests.cs index dcc43825b..8ea890997 100644 --- a/Assets/Mirror/Tests/Editor/NetworkTransform/NetworkTransform2kTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkTransform/NetworkTransform2kTests.cs @@ -314,6 +314,9 @@ public void OnServerToClientSync_WithClientAuthority_Nullables_Uses_Last() component.netIdentity.isClient = true; component.netIdentity.isLocalPlayer = true; + // client authority has to be disabled + component.syncDirection = SyncDirection.ServerToClient; + // call OnClientToServerSync with authority and nullable types // to make sure it uses the last valid position then. component.OnServerToClientSync(new Vector3?(), new Quaternion?(), new Vector3?());