BoltDebugStart window options - EditorMode: Server Clients:1 BuildOptions: Development Build
Open Bolt Debug Start
push SinglePlayer/Run as Server on a scene that is not the current scene in editor
close Bolt Debug Start Window
stop play
BoltDebugStart scene will be in the editor instead of your last scene.
if Bolt Debug Start window is left open, it does correctly restore you to the last scene but if it's closed it will not.
To fix this you can use code similar to below in a static class. Probably you already have some similar code that restores the scene but is not static and not InitializeOnLoad.
`
[InitializeOnLoad]
static class BoltDebugStartWindowRestoreScene
{
// Static constructor binds a playmode-changed callback.
// [InitializeOnLoad] above makes sure this gets executed.
static BoltDebugStartWindowRestoreScene()
{
EditorApplication.playModeStateChanged += EditorApplication_playModeStateChanged;
}
// Play mode change callback handles the scene load/reload.
static void EditorApplication_playModeStateChanged(PlayModeStateChange obj)
{
switch(obj)
{
case PlayModeStateChange.ExitingEditMode:
SaveCurrentSceneName();
break;
case PlayModeStateChange.EnteredEditMode:
LoadPreviousScene();
break;
}
}
static void SaveCurrentSceneName() {
lastSceneSetting = EditorSceneManager.GetActiveScene().path;
}
static void LoadPreviousScene() {
EditorSceneManager.OpenScene(lastSceneSetting);
}
`
Expected Behavior
Bolt Debug Start window should restore you to the correct editor scene you were in before you used it
Actual behavior
BoltDebugStart scene is shown in the editor instead of the scene you were working in before hitting Run as Server/Singleplayer using Bolt Debug Start window
How to reproduce issue
BoltDebugStart window options - EditorMode: Server Clients:1 BuildOptions: Development Build
BoltDebugStart scene will be in the editor instead of your last scene.
if Bolt Debug Start window is left open, it does correctly restore you to the last scene but if it's closed it will not.
To fix this you can use code similar to below in a static class. Probably you already have some similar code that restores the scene but is not static and not InitializeOnLoad.
` [InitializeOnLoad] static class BoltDebugStartWindowRestoreScene { // Static constructor binds a playmode-changed callback. // [InitializeOnLoad] above makes sure this gets executed. static BoltDebugStartWindowRestoreScene() { EditorApplication.playModeStateChanged += EditorApplication_playModeStateChanged; }
`
Expected Behavior
Bolt Debug Start window should restore you to the correct editor scene you were in before you used it
Actual behavior
BoltDebugStart scene is shown in the editor instead of the scene you were working in before hitting Run as Server/Singleplayer using Bolt Debug Start window
Configuration