Init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneBootstrapLoaderWindow : EditorWindow
|
||||
{
|
||||
[MenuItem("Tools/Scenes/Bootstrap Loader")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
var window = GetWindow<SceneBootstrapLoaderWindow>("Bootstrap Loader");
|
||||
window.minSize = new Vector2(420, 110);
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
GUILayout.Space(8);
|
||||
|
||||
SceneBootstrapLoader.Enabled = EditorGUILayout.Toggle(
|
||||
new GUIContent("Enabled", "Always start Play Mode from bootstrap scene"),
|
||||
SceneBootstrapLoader.Enabled
|
||||
);
|
||||
|
||||
var currentAsset = string.IsNullOrWhiteSpace(SceneBootstrapLoader.BootstrapScenePath)
|
||||
? null
|
||||
: AssetDatabase.LoadAssetAtPath<SceneAsset>(SceneBootstrapLoader.BootstrapScenePath);
|
||||
|
||||
var newAsset = (SceneAsset)EditorGUILayout.ObjectField(
|
||||
new GUIContent("Bootstrap Scene", "Scene used as playModeStartScene"),
|
||||
currentAsset,
|
||||
typeof(SceneAsset),
|
||||
false
|
||||
);
|
||||
|
||||
string newPath = newAsset != null ? AssetDatabase.GetAssetPath(newAsset) : string.Empty;
|
||||
if (newPath != SceneBootstrapLoader.BootstrapScenePath)
|
||||
SceneBootstrapLoader.BootstrapScenePath = newPath;
|
||||
|
||||
GUILayout.Space(8);
|
||||
|
||||
EditorGUILayout.HelpBox(
|
||||
"When enabled, Play Mode always starts from the selected bootstrap scene. " +
|
||||
"The path of the scene you launched from is saved and can be loaded by bootstrap at runtime.",
|
||||
MessageType.Info
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user