Skip to content

Commit 389c2f6

Browse files
committed
Enforced the EnableSceneSwitching config
1 parent 6d98322 commit 389c2f6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

MLAPI/NetworkingManagerComponents/NetworkSceneManager.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ internal static class NetworkSceneManager
1919

2020
public static void SwitchScene(string sceneName)
2121
{
22-
if (isSwitching)
22+
if(!NetworkingManager.singleton.NetworkConfig.EnableSceneSwitching)
23+
{
24+
Debug.LogWarning("MLAPI: Scene switching is not enabled");
25+
return;
26+
}
27+
else if (isSwitching)
2328
{
2429
Debug.LogWarning("MLAPI: Scene switch already in progress");
2530
return;
@@ -45,7 +50,12 @@ public static void SwitchScene(string sceneName)
4550

4651
internal static void OnSceneSwitch(uint sceneIndex)
4752
{
48-
if(!sceneIndexToString.ContainsKey(sceneIndex) ||registeredSceneNames.Contains(sceneIndexToString[sceneIndex]))
53+
if (!NetworkingManager.singleton.NetworkConfig.EnableSceneSwitching)
54+
{
55+
Debug.LogWarning("MLAPI: Scene switching is not enabled but was requested by the server");
56+
return;
57+
}
58+
else if (!sceneIndexToString.ContainsKey(sceneIndex) ||registeredSceneNames.Contains(sceneIndexToString[sceneIndex]))
4959
{
5060
Debug.LogWarning("MLAPI: Server requested a scene switch to a non registered scene");
5161
return;

0 commit comments

Comments
 (0)