1
+ using System ;
1
2
using System . Collections ;
2
3
using UnityEngine ;
3
4
using NUnit . Framework ;
@@ -12,7 +13,7 @@ public abstract class TestUtilities
12
13
13
14
/// <summary>
14
15
/// Helper wrapper method for asserting the completion of a scene load to be used inside Playmode tests. A scene
15
- /// is either loaded successfully, or the loading process has timed out.
16
+ /// is either loaded successfully, or the loading process has timed out and will throw an exception .
16
17
/// </summary>
17
18
/// <param name="sceneName"> Name of scene </param>
18
19
/// <returns> IEnumerator to track scene load process </returns>
@@ -26,8 +27,8 @@ public static IEnumerator AssertIsSceneLoaded(string sceneName)
26
27
}
27
28
28
29
/// <summary>
29
- /// Helper wrapper method for asserting the completion of a scene load to be used inside Playmode tests. A scene
30
- /// is either loaded successfully, or the loading process has timed out.
30
+ /// Helper wrapper method for asserting the completion of a network scene load to be used inside Playmode tests.
31
+ /// A scene is either loaded successfully, or the loading process has timed out and will throw an exception .
31
32
/// </summary>
32
33
/// <param name="sceneName"> Name of scene </param>
33
34
/// <param name="networkSceneManager"> NetworkSceneManager instance </param>
@@ -68,6 +69,8 @@ public override bool keepWaiting
68
69
if ( Time . time - m_LoadSceneStart >= m_MaxLoadDuration )
69
70
{
70
71
TimedOut = true ;
72
+
73
+ throw new Exception ( $ "Timeout for scene load for scene name { m_SceneName } ") ;
71
74
}
72
75
73
76
return ! isSceneLoaded && ! TimedOut ;
@@ -83,8 +86,8 @@ public WaitForSceneLoad(string sceneName, float maxLoadDuration = k_MaxSceneLoad
83
86
}
84
87
85
88
/// <summary>
86
- /// Custom IEnumerator class to validate the loading of a Scene by name. If a scene load lasts longer than
87
- /// k_MaxSceneLoadDuration it is considered a timeout.
89
+ /// Custom IEnumerator class to validate the loading of a Scene through Netcode for GameObjects by name.
90
+ /// If a scene load lasts longer than k_MaxSceneLoadDuration it is considered a timeout.
88
91
/// </summary>
89
92
class WaitForNetworkSceneLoad : CustomYieldInstruction
90
93
{
@@ -109,6 +112,8 @@ public override bool keepWaiting
109
112
TimedOut = true ;
110
113
111
114
m_NetworkSceneManager . OnSceneEvent -= ConfirmSceneLoad ;
115
+
116
+ throw new Exception ( $ "Timeout for network scene load for scene name { m_SceneName } ") ;
112
117
}
113
118
114
119
return ! m_IsNetworkSceneLoaded && ! TimedOut ;
0 commit comments