Skip to content

Commit 7165385

Browse files
Merge branch 'develop-2.0.0' into codeowners-correction-2.x
2 parents 66fe0df + 464e7cb commit 7165385

22 files changed

+218
-113
lines changed

.yamato/_run-all.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ run_all_webgl_builds:
8181
dependencies:
8282
{% for project in projects.default -%}
8383
{% for platform in test_platforms.desktop -%}
84+
{% if platform.name != "mac" -%} # There is an error about "Light baking could not be started because no valid OpenCL device could be found". Tracked in MTT-11726
8485
{% for editor in validation_editors.all -%}
8586
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
8687
{% endfor -%}
88+
{% endif -%}
8789
{% endfor -%}
8890
{% endfor -%}
8991

@@ -94,9 +96,11 @@ run_all_webgl_builds_trunk:
9496
dependencies:
9597
{% for project in projects.default -%}
9698
{% for platform in test_platforms.desktop -%}
99+
{% if platform.name != "mac" -%} # There is an error about "Light baking could not be started because no valid OpenCL device could be found". Tracked in MTT-11726
97100
{% for editor in validation_editors.default -%}
98101
- .yamato/webgl-build.yml#webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}
99102
{% endfor -%}
103+
{% endif -%}
100104
{% endfor -%}
101105
{% endfor -%}
102106

.yamato/webgl-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
{% for project in projects.default -%}
2727
{% for platform in test_platforms.desktop -%}
28+
{% if platform.name != "mac" -%} # There is an error about "Light baking could not be started because no valid OpenCL device could be found". Tracked in MTT-11726
2829
{% for editor in validation_editors.all -%}
2930
webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}:
3031
name: WebGl Build - {{ project.name }} [{{ platform.name }}, {{ editor }}, il2cpp]
@@ -51,5 +52,6 @@ webgl_build_{{ project.name }}_{{ platform.name }}_{{ editor }}:
5152
- "artifacts/**/*"
5253
- "build/players/**/*"
5354
{% endfor -%}
55+
{% endif -%}
5456
{% endfor -%}
5557
{% endfor -%}

com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,24 @@ private void AddRemoveNetworkManager(NetworkManager networkManager, bool addNetw
466466
/// CreateAndStartNewClient Only
467467
/// Invoked when the newly created client has been created
468468
/// </summary>
469+
/// <param name="networkManager">The NetworkManager instance of the client.</param>
469470
protected virtual void OnNewClientCreated(NetworkManager networkManager)
470471
{
472+
// Ensure any late joining client has all NetworkPrefabs required to connect.
473+
foreach (var networkPrefab in m_ServerNetworkManager.NetworkConfig.Prefabs.Prefabs)
474+
{
475+
if (!networkManager.NetworkConfig.Prefabs.Contains(networkPrefab.Prefab))
476+
{
477+
networkManager.NetworkConfig.Prefabs.Add(networkPrefab);
478+
}
479+
}
471480
}
472481

473482
/// <summary>
474483
/// CreateAndStartNewClient Only
475484
/// Invoked when the newly created client has been created and started
476485
/// </summary>
486+
/// <param name="networkManager">The NetworkManager instance of the client.</param>
477487
protected virtual void OnNewClientStarted(NetworkManager networkManager)
478488
{
479489
}
@@ -483,6 +493,7 @@ protected virtual void OnNewClientStarted(NetworkManager networkManager)
483493
/// Invoked when the newly created client has been created, started, and connected
484494
/// to the server-host.
485495
/// </summary>
496+
/// <param name="networkManager">The NetworkManager instance of the client.</param>
486497
protected virtual void OnNewClientStartedAndConnected(NetworkManager networkManager)
487498
{
488499
}
@@ -494,6 +505,8 @@ protected virtual void OnNewClientStartedAndConnected(NetworkManager networkMana
494505
/// <remarks>
495506
/// Use this for testing connection and disconnection scenarios
496507
/// </remarks>
508+
/// <param name="networkManager">The NetworkManager instance of the client.</param>
509+
/// <returns>True if the test should wait for the client to connect; otherwise, false.</returns>
497510
protected virtual bool ShouldWaitForNewClientToConnect(NetworkManager networkManager)
498511
{
499512
return true;
@@ -503,6 +516,7 @@ protected virtual bool ShouldWaitForNewClientToConnect(NetworkManager networkMan
503516
/// This will create, start, and connect a new client while in the middle of an
504517
/// integration test.
505518
/// </summary>
519+
/// <returns>An IEnumerator to be used in a coroutine for asynchronous execution.</returns>
506520
protected IEnumerator CreateAndStartNewClient()
507521
{
508522
var networkManager = NetcodeIntegrationTestHelpers.CreateNewClient(m_ClientNetworkManagers.Length, m_EnableTimeTravel);

com.unity.netcode.gameobjects/Tests/Runtime/DeferredMessagingTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ protected override void OnNewClientCreated(NetworkManager networkManager)
259259
{
260260
AddPrefabsToClient(networkManager);
261261
}
262-
263-
base.OnNewClientCreated(networkManager);
262+
// Don't call base to avoid synchronizing the prefabs
264263
}
265264

266265
private void SpawnClients(bool clearTestDeferredMessageManagerCallFlags = true)

com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/DistributeObjectsTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,6 @@ private bool ValidateTransformsMatch()
235235
return true;
236236
}
237237

238-
protected override void OnNewClientCreated(NetworkManager networkManager)
239-
{
240-
networkManager.NetworkConfig.Prefabs = m_ServerNetworkManager.NetworkConfig.Prefabs;
241-
base.OnNewClientCreated(networkManager);
242-
}
243-
244238
private bool SpawnCountsMatch()
245239
{
246240
var passed = true;

com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/ExtendedNetworkShowAndHideTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ protected override void OnNewClientCreated(NetworkManager networkManager)
9797
{
9898
m_LateJoinClient = networkManager;
9999
networkManager.NetworkConfig.EnableSceneManagement = m_EnableSceneManagement;
100-
networkManager.NetworkConfig.Prefabs = m_SpawnOwner.NetworkConfig.Prefabs;
101100
base.OnNewClientCreated(networkManager);
102101
}
103102

com.unity.netcode.gameobjects/Tests/Runtime/DistributedAuthority/NetworkClientAndPlayerObjectTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ protected override void OnServerAndClientsCreated()
4545

4646
protected override void OnNewClientCreated(NetworkManager networkManager)
4747
{
48-
networkManager.NetworkConfig.Prefabs = m_ServerNetworkManager.NetworkConfig.Prefabs;
4948
if (m_DistributedAuthority)
5049
{
5150
networkManager.OnFetchLocalPlayerPrefabToSpawn = FetchPlayerPrefabToSpawn;

com.unity.netcode.gameobjects/Tests/Runtime/NetworkBehaviourPrePostSpawnTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ protected override IEnumerator OnSetup()
9393
return base.OnSetup();
9494
}
9595

96-
protected override void OnNewClientCreated(NetworkManager networkManager)
97-
{
98-
networkManager.NetworkConfig.Prefabs = m_ServerNetworkManager.NetworkConfig.Prefabs;
99-
base.OnNewClientCreated(networkManager);
100-
}
101-
10296
/// <summary>
10397
/// This validates that pre spawn can be used to instantiate and assign a NetworkVariable (or other prespawn tasks)
10498
/// which can be useful for assigning a NetworkVariable value on the server side when the NetworkVariable has owner write permissions.

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ private bool CheckClientsSideObserverTestObj()
8686
/// </summary>
8787
protected override void OnNewClientCreated(NetworkManager networkManager)
8888
{
89-
foreach (var networkPrefab in m_ServerNetworkManager.NetworkConfig.Prefabs.Prefabs)
90-
{
91-
if (!networkManager.NetworkConfig.Prefabs.Contains(networkPrefab.Prefab))
92-
{
93-
networkManager.NetworkConfig.Prefabs.Add(networkPrefab);
94-
}
95-
}
9689
networkManager.NetworkConfig.EnableSceneManagement = m_ServerNetworkManager.NetworkConfig.EnableSceneManagement;
9790
base.OnNewClientCreated(networkManager);
9891
}

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,16 @@ protected override void OnServerAndClientsCreated()
8181

8282
protected override void OnNewClientCreated(NetworkManager networkManager)
8383
{
84+
// Setup late joining client prefabs first
85+
base.OnNewClientCreated(networkManager);
86+
8487
networkManager.NetworkConfig.PlayerPrefab = m_PlayerPrefab;
8588
networkManager.NetworkConfig.EnsureNetworkVariableLengthSafety = m_VariableLengthSafety == VariableLengthSafety.EnabledNetVarSafety;
86-
foreach (var networkPrefab in m_ServerNetworkManager.NetworkConfig.Prefabs.Prefabs)
87-
{
88-
// To simulate a failure, we exclude the m_InValidNetworkPrefab from the connecting
89-
// client's side.
90-
if (networkPrefab.Prefab.name != m_InValidNetworkPrefab.name)
91-
{
92-
networkManager.NetworkConfig.Prefabs.Add(networkPrefab);
93-
}
94-
}
9589
// Disable forcing the same prefabs to avoid failed connections
9690
networkManager.NetworkConfig.ForceSamePrefabs = false;
9791
networkManager.LogLevel = m_CurrentLogLevel;
98-
base.OnNewClientCreated(networkManager);
92+
// To simulate a failure, exclude the m_InValidNetworkPrefab from the connecting client's side.
93+
networkManager.NetworkConfig.Prefabs.Remove(m_InValidNetworkPrefab);
9994
}
10095

10196
[UnityTest]

0 commit comments

Comments
 (0)