Skip to content

Commit 6d8f7a6

Browse files
Merge branch 'develop-2.0.0' into feat/attachable-networkbehaviour-and-object-controller
2 parents 912b26f + 2a5de93 commit 6d8f7a6

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

com.unity.netcode.gameobjects/Tests/Editor/Build/BuildTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ internal class BuildTests
1212
{
1313
public const string DefaultBuildScenePath = "Tests/Editor/Build/BuildTestScene.unity";
1414

15+
// Increased the Build test timeout from 3 to 10 minutes.
16+
[Timeout(900000)]
1517
[Test]
1618
public void BasicBuildTest()
1719
{

com.unity.netcode.gameobjects/Tests/Runtime/NetworkObject/PlayerSpawnObjectVisibilityTests.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,25 @@ protected override void OnCreatePlayerPrefab()
6363
base.OnCreatePlayerPrefab();
6464
}
6565

66+
/// <summary>
67+
/// Bypassing this on v1.x as the deferred show message could be processed on the next
68+
/// frame from when the client registers having connected.
69+
/// </summary>
70+
protected override bool ShouldWaitForNewClientToConnect(NetworkManager networkManager)
71+
{
72+
return false;
73+
}
74+
75+
/// <summary>
76+
/// Validate that the player object is spawned on the client side.
77+
/// </summary>
78+
/// <returns></returns>
79+
private bool ClientSpawnedPlayer()
80+
{
81+
var playerObject = m_ClientNetworkManagers[0].LocalClient.PlayerObject;
82+
return playerObject != null && playerObject.IsSpawned && playerObject.IsOwner;
83+
}
84+
6685
/// <summary>
6786
/// Tests the scenario where under a client-server network topology if a player prefab
6887
/// is spawned by the server with no observers but the player prefab itself has server
@@ -81,7 +100,17 @@ public IEnumerator NetworkShowOnSpawnTest([Values] PlayerSpawnStages spawnStage)
81100

82101
yield return CreateAndStartNewClient();
83102

84-
yield return new WaitForSeconds(0.25f);
103+
// Wait for the new client to connect
104+
yield return WaitForClientsConnectedOrTimeOut();
105+
AssertOnTimeout($"Timed out waiting for client to connect!");
106+
OnNewClientStartedAndConnected(m_ClientNetworkManagers[0]);
107+
108+
// Wait for the new client to have spawned the player
109+
yield return WaitForConditionOrTimeOut(ClientSpawnedPlayer);
110+
AssertOnTimeout($"Timed out waiting for client to spawn its player object!");
111+
112+
// Provide some time to assure there are no additional attempts to spawn the same instance
113+
yield return new WaitForSeconds(0.5f);
85114

86115
NetcodeLogAssert.LogWasNotReceived(LogType.Warning, new Regex("but it is already in the spawned list!"));
87116
var client = GetNonAuthorityNetworkManager();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ public override void OnUpdate()
270270
// Add it to the table of state updates
271271
var stateEntry = new StateEntry()
272272
{
273-
TimeAdded = Time.realtimeSinceStartup,
273+
// Use the server time to get the valid "relative" time since the session started.
274+
TimeAdded = NetworkManager.ServerTime.TimeAsFloat,
274275
State = m_PosInterpolator.InterpolateState,
275276
};
276277

0 commit comments

Comments
 (0)