forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrontendBootstrap.cs
More file actions
30 lines (26 loc) · 831 Bytes
/
Copy pathFrontendBootstrap.cs
File metadata and controls
30 lines (26 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Samples.HelloNetcode
{
public class FrontendBootstrap : MonoBehaviour
{
void Start()
{
#if UNITY_SERVER
string sceneName = "Asteroids";
#else
string sceneName = "Frontend";
#endif
// Commandline always overrides defaults if it exists
string commandScene = CommandLineUtils.GetCommandLineValueFromKey("scene");
if (!string.IsNullOrEmpty(commandScene))
{
var scene = SceneManager.GetSceneByName(commandScene);
if (!scene.IsValid())
Debug.LogWarning($"Scene '{commandScene}' not found, using default '{sceneName}' instead");
}
SceneManager.LoadScene(sceneName);
}
}
}