This is the closest I’ve gotten:
EditorSceneManager.OpenScene(
AssetDatabase.GUIDToAssetPath(
AssetDatabase.FindAssets(
"t:SceneAsset " + MenuSceneName,
new string[] { "Assets" }
)[0]
)
);
However this generates an error at runtime:
InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.
I can’t follow its suggestion because those functions require the scene to be in build settings or an asset bundle. So, is there any other option?
I wonder how (and if) Addressables achieve this? Note: I’m not willing to switch to Addressables - I’m quite enjoying working with AssetBundles.
Why?
My game uses AssetBundles for general loading of EVERYTHING, so there’s only one blank scene in build settings. However, during development I’d rather not have to continuously build and load from AssetBundles, so I’m trying to dynamically load scenes WITHOUT having to add them to build settings.