Skip to content

Commit f2ee335

Browse files
test fix
Fixing potential cause for instabilities on this set of tests due to the initial network prefab transform settings not being applied to the prefab but applied to the spawned instances which could be causing issues since they were being applied to the non-authority instances. This fix moves the applied test NetworkTrransform settings to the player prefab prior to spawning any instances.
1 parent 4838f97 commit f2ee335

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ protected override void OnCreatePlayerPrefab()
230230
{
231231
var networkTransformTestComponent = m_PlayerPrefab.AddComponent<NetworkTransformTestComponent>();
232232
networkTransformTestComponent.ServerAuthority = m_Authority == Authority.ServerAuthority;
233+
// Handle setting up additional transform settings for the current test here.
234+
networkTransformTestComponent.UseUnreliableDeltas = UseUnreliableDeltas();
235+
networkTransformTestComponent.UseHalfFloatPrecision = m_Precision == Precision.Half;
236+
networkTransformTestComponent.UseQuaternionSynchronization = m_Rotation == Rotation.Quaternion;
237+
networkTransformTestComponent.UseQuaternionCompression = m_RotationCompression == RotationCompression.QuaternionCompress;
233238
}
234239

235240
protected override void OnServerAndClientsCreated()
@@ -291,19 +296,6 @@ protected virtual void OnClientsAndServerConnectedSetup()
291296
// Get the NetworkTransformTestComponent to make sure the client side is ready before starting test
292297
m_AuthoritativeTransform = m_AuthoritativePlayer.GetComponent<NetworkTransformTestComponent>();
293298
m_NonAuthoritativeTransform = m_NonAuthoritativePlayer.GetComponent<NetworkTransformTestComponent>();
294-
295-
// Setup whether we are or are not using unreliable deltas
296-
m_AuthoritativeTransform.UseUnreliableDeltas = UseUnreliableDeltas();
297-
m_NonAuthoritativeTransform.UseUnreliableDeltas = UseUnreliableDeltas();
298-
299-
m_AuthoritativeTransform.UseHalfFloatPrecision = m_Precision == Precision.Half;
300-
m_AuthoritativeTransform.UseQuaternionSynchronization = m_Rotation == Rotation.Quaternion;
301-
m_AuthoritativeTransform.UseQuaternionCompression = m_RotationCompression == RotationCompression.QuaternionCompress;
302-
m_NonAuthoritativeTransform.UseHalfFloatPrecision = m_Precision == Precision.Half;
303-
m_NonAuthoritativeTransform.UseQuaternionSynchronization = m_Rotation == Rotation.Quaternion;
304-
m_NonAuthoritativeTransform.UseQuaternionCompression = m_RotationCompression == RotationCompression.QuaternionCompress;
305-
306-
307299
m_OwnerTransform = m_AuthoritativeTransform.IsOwner ? m_AuthoritativeTransform : m_NonAuthoritativeTransform;
308300
}
309301

0 commit comments

Comments
 (0)