File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Assets/BossRoom/Scripts/Editor Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
using UnityEditor ;
2
2
using UnityEditor . SceneManagement ;
3
3
using UnityEngine ;
4
- using UnityEngine . SceneManagement ;
5
4
6
5
namespace Unity . Multiplayer . Samples . BossRoom . Editor
7
6
{
@@ -35,6 +34,8 @@ public class SceneBootstrapper
35
34
const string k_LoadBootstrapSceneOnPlay = "Boss Room/Load Bootstrap Scene On Play" ;
36
35
const string k_DoNotLoadBootstrapSceneOnPlay = "Boss Room/Don't Load Bootstrap Scene On Play" ;
37
36
37
+ const string k_TestRunnerObjectName = "Code-based tests runner" ;
38
+
38
39
static bool s_StoppingAndStarting ;
39
40
40
41
static string BootstrapScene
@@ -100,13 +101,9 @@ static void DisableDoNotLoadBootstrapSceneOnPlay()
100
101
101
102
static void EditorApplicationOnplayModeStateChanged ( PlayModeStateChange obj )
102
103
{
103
- // detects whether playmode has been initiated by a TestRunner Playmode test; if so disable Boostrap loading
104
- for ( int i = 0 ; i < SceneManager . sceneCount ; i ++ )
104
+ if ( IsTestRunnerActive ( ) )
105
105
{
106
- if ( SceneManager . GetSceneAt ( i ) . name . Contains ( "InitTestScene" ) )
107
- {
108
- return ;
109
- }
106
+ return ;
110
107
}
111
108
112
109
if ( ! LoadBootstrapScene )
@@ -167,5 +164,10 @@ static void EditorApplicationOnplayModeStateChanged(PlayModeStateChange obj)
167
164
}
168
165
}
169
166
}
167
+
168
+ static bool IsTestRunnerActive ( )
169
+ {
170
+ return GameObject . Find ( k_TestRunnerObjectName ) ;
171
+ }
170
172
}
171
173
}
You can’t perform that action at this time.
0 commit comments