First commit on my server, yey!

This commit is contained in:
Sebastian Bularca
2026-03-19 18:12:07 +01:00
parent 5139ec2cec
commit fedd1961a0
602 changed files with 101587 additions and 6 deletions

42
Assets/Code/Core/Boot.cs Normal file
View File

@@ -0,0 +1,42 @@
using Nox.EditorCode;
using System;
using Unity.VectorGraphics;
using UnityEditor;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.SceneManagement;
namespace Nox.Core {
public class Boot {
/// <summary>
/// The is the first method called when the game starts. It will load the Initializer prefab which will initialize the project
/// </summary>
[RuntimeInitializeOnLoadMethod]
private static void Initialize() {
#if UNITY_EDITOR
switch(BootMode.BootType) {
case BootType.UnityDefault:
return;
case BootType.SceneBoot:
Addressables.InstantiateAsync("Initializer").WaitForCompletion();
break;
case BootType.FullBoot:
var loadOperation = SceneManager.LoadSceneAsync("Startup", LoadSceneMode.Single);
if(loadOperation != null) {
loadOperation.completed += OnCompleted;
}
break;
default:
throw new ArgumentOutOfRangeException();
}
#else
Addressables.InstantiateAsync("Initializer").WaitForCompletion();
#endif
}
private static void OnCompleted(AsyncOperation obj) {
obj.allowSceneActivation = true;
Addressables.InstantiateAsync("Initializer").WaitForCompletion();
}
}
}