Skip to content

Commit 5840a69

Browse files
fix: resolves the issue with console crashes (#2411)
* fix This fixes the issue with nightly crashes in the ParentDynamicUnderInScenePlaced test. * update adding comment about the fix for console crashes.
1 parent 61e2257 commit 5840a69

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

testproject/Assets/Tests/Runtime/ObjectParenting/ParentDynamicUnderInScenePlaced.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ protected override void OnServerAndClientsCreated()
4242

4343
protected override IEnumerator OnStartedServerAndClients()
4444
{
45-
m_ServerNetworkManager.SceneManager.DisableValidationWarnings(true);
46-
m_ServerNetworkManager.SceneManager.ClientSynchronizationMode = LoadSceneMode.Additive;
45+
m_ServerNetworkManager.SceneManager.SetClientSynchronizationMode(LoadSceneMode.Additive);
4746
return base.OnStartedServerAndClients();
4847
}
4948

@@ -65,7 +64,8 @@ protected override void OnNewClientStarted(NetworkManager networkManager)
6564
private NetworkObject m_FailedValidation;
6665
private bool TestParentedAndNotInScenePlaced()
6766
{
68-
var serverPlayer = m_ServerNetworkManager.LocalClient.PlayerObject;
67+
// Always assign m_FailedValidation to avoid possible null reference crashes.
68+
var serverPlayer = m_FailedValidation = m_ServerNetworkManager.LocalClient.PlayerObject;
6969
if (serverPlayer.transform.parent == null || serverPlayer.IsSceneObject.Value == true)
7070
{
7171
m_FailedValidation = serverPlayer;
@@ -111,9 +111,11 @@ public IEnumerator ParentUnderInSceneplaced()
111111
m_ServerNetworkManager.SceneManager.LoadScene(k_SceneToLoad, LoadSceneMode.Additive);
112112
// Wait for the scene with the in-scene placed NetworkObject to be loaded
113113
yield return WaitForConditionOrTimeOut(() => m_SceneIsLoaded == true);
114+
AssertOnTimeout($"Timed out waiting for the scene {k_SceneToLoad} to load!");
114115

115116
// Wait for the host-server's player to be parented under the in-scene placed NetworkObject
116117
yield return WaitForConditionOrTimeOut(TestParentedAndNotInScenePlaced);
118+
AssertOnTimeout($"[{m_FailedValidation.name}] Failed validation! InScenePlaced ({m_FailedValidation.IsSceneObject.Value}) | Was Parented ({m_FailedValidation.transform.position != null})");
117119

118120
// Now dynamically spawn a NetworkObject to also test dynamically spawned NetworkObjects being parented
119121
// under in-scene placed NetworkObjects

0 commit comments

Comments
 (0)