Skip to content

Commit 1bd8559

Browse files
Update - Exp
Experimenting with adjusting when transport adds inbound messages to the NGO inbound queue relative to when time is updated and NGO's inbound messages are processed.
1 parent ec9b2fb commit 1bd8559

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,18 @@ public void NetworkUpdate(NetworkUpdateStage updateStage)
300300

301301
DeferredMessageManager.ProcessTriggers(IDeferredNetworkMessageManager.TriggerType.OnNextFrame, 0);
302302

303+
#if COM_UNITY_MODULES_PHYSICS
304+
NetworkTimeSystem.UpdateTime();
305+
306+
// Transport processes events after time has been updated
307+
NetworkConfig.NetworkTransport.PreUpdate();
308+
#endif
309+
303310
AnticipationSystem.SetupForUpdate();
304311
MessageManager.ProcessIncomingMessageQueue();
305312
MessageManager.CleanupDisconnectedClients();
306313
AnticipationSystem.ProcessReanticipation();
314+
307315
}
308316
break;
309317
#if COM_UNITY_MODULES_PHYSICS
@@ -331,10 +339,14 @@ public void NetworkUpdate(NetworkUpdateStage updateStage)
331339
#endif
332340
case NetworkUpdateStage.PreUpdate:
333341
{
342+
#if !COM_UNITY_MODULES_PHYSICS
334343
NetworkTimeSystem.UpdateTime();
335344
AnticipationSystem.Update();
336345
// Transport processes events after time has been updated
337346
NetworkConfig.NetworkTransport.PreUpdate();
347+
#else
348+
AnticipationSystem.Update();
349+
#endif
338350
}
339351
break;
340352
case NetworkUpdateStage.PreLateUpdate:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ protected override void OnServerAndClientsCreated()
4646
rigidBody.maxLinearVelocity = 0;
4747
rigidBody.mass = 0;
4848
rigidBody.detectCollisions = false;
49+
rigidBody.position = Vector3.zero;
50+
rigidBody.rotation = Quaternion.identity;
51+
rigidBody.transform.position = Vector3.zero;
52+
rigidBody.transform.rotation = Quaternion.identity;
4953
// NOTE: We don't use a sphere collider for this integration test because by the time we can
5054
// assure they don't collide and skew the results the NetworkObjects are already synchronized
5155
// with skewed results
@@ -60,6 +64,10 @@ protected override void OnServerAndClientsCreated()
6064
rigidBody.interpolation = RigidbodyInterpolation.None;
6165
rigidBody.maxLinearVelocity = 0;
6266
rigidBody.detectCollisions = false;
67+
rigidBody.position = Vector3.zero;
68+
rigidBody.rotation = Quaternion.identity;
69+
rigidBody.transform.position = Vector3.zero;
70+
rigidBody.transform.rotation = Quaternion.identity;
6371
// NOTE: We don't use a sphere collider for this integration test because by the time we can
6472
// assure they don't collide and skew the results the NetworkObjects are already synchronized
6573
// with skewed results

0 commit comments

Comments
 (0)