-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrapper.cs
33 lines (28 loc) · 979 Bytes
/
Bootstrapper.cs
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
31
32
33
//using Unity.Services.Core;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Bootstrapper : MonoBehaviour
{
async void Start()
{
Application.runInBackground = true;
//await UnityServices.InitializeAsync();
if (SceneManager.loadedSceneCount == 1)
SceneManager.LoadScene("CarSelection", LoadSceneMode.Additive);
}
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Init()
{
#if UNITY_EDITOR
var currentlyLoadedEditorScene = SceneManager.GetActiveScene();
#endif
if (SceneManager.GetSceneByName("Bootstrapper").isLoaded != true)
SceneManager.LoadScene("Bootstrapper");
#if UNITY_EDITOR
if (currentlyLoadedEditorScene.IsValid())
SceneManager.LoadSceneAsync(currentlyLoadedEditorScene.name, LoadSceneMode.Additive);
#else
SceneManager.LoadSceneAsync("CarSelection", LoadSceneMode.Additive);
#endif
}
}