Any examples of LoadSceneInPlayMode

Hi all!

Do anyone have an examples of EditorSceneManager.LoadSceneInPlayMode behaviour?

I’m making “AssetBundle Loader Emulator” in Editor, to emulate a scene load from asset bundle, without add scene paths to “Build settings → Scene Paths”.
I’m trying use this :

EditorSceneManager.LoadSceneInPlayMode ("Bundles/Town/Town", new LoadSceneParameters (LoadSceneMode.Single, LocalPhysicsMode.None));

I tried to use many variants of Scene path,
but always Unity load scene “Town” without any objects and camera.

Do anyone have any idea?
Thanks!

I have exactly same problem. LoadSceneAsyncInPlayMode works though.

I have a problem like this too.
Isn’t there a solution?

Any tips on how you solved this issue?

This code worked fine.

var guid = AssetDatabase.FindAssets($"{sceneName} t:scene")[0];
var path = AssetDatabase.GUIDToAssetPath(guid);
Debug.Log(path); // Assets/FooScene.unity
EditorSceneManager.LoadSceneAsyncInPlayMode(path, new LoadSceneParameters(LoadSceneMode.Single));
2 Likes

Using fumobox’s solution I logged out the path of the scene I was trying to load and found that I had missed the “Assets/” at the beginning of the path I was trying to load.

It seems that LoadSceneAsyncInPlayMode will just create a scene with the name you provide if there is nothing at the path you give it. Neat!