forked from Shardstone/trail-into-darkness
First commit on my server, yey!
This commit is contained in:
46
Assets/Code/Util/BootMode.cs
Normal file
46
Assets/Code/Util/BootMode.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nox.EditorCode {
|
||||
#if UNITY_EDITOR
|
||||
public enum BootType {
|
||||
FullBoot,
|
||||
SceneBoot,
|
||||
UnityDefault
|
||||
}
|
||||
/// <summary>
|
||||
/// Allows the user to set the boot mode for the project which will be used by the EntryPoint to mark if the startup scene should be loaded or not
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
public class BootMode : MonoBehaviour {
|
||||
public static BootType BootType {
|
||||
get => (BootType)EditorPrefs.GetInt("bootType");
|
||||
private set {
|
||||
EditorPrefs.SetInt("bootType", (int)value);
|
||||
Debug.Log($"Boot mode {BootType} set...");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable() {
|
||||
if(!EditorPrefs.HasKey("bootType")) {
|
||||
BootType = BootType.UnityDefault;
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Nox/Boot/Full Boot...", false)]
|
||||
private static void SetFullBoot() {
|
||||
BootType = BootType.FullBoot;
|
||||
}
|
||||
|
||||
[MenuItem("Nox/Boot/Scene Boot...", false)]
|
||||
private static void SetSceneBoot() {
|
||||
BootType = BootType.SceneBoot;
|
||||
}
|
||||
|
||||
[MenuItem("Nox/Boot/Unity Default No Boot...", false)]
|
||||
private static void SetDefaultBoot() {
|
||||
BootType = BootType.UnityDefault;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user