Want to change scenes additively in editor, using scripting.

The unity UI lets you right click on a scene and choose “Open Scene Additive”.

I want to do this in a script in the EDITOR. I try this in the Update() method of one of my MonoBehaviors:

     EditorSceneManager.LoadScene("MyAdditiveScene", LoadSceneMode.Additive);

And I get:

InvalidOperationException: This can
only be used during play mode, please
use EditorSceneManager.OpenScene()
instead.
UnityEngine.SceneManagement.SceneManager.LoadScene
(System.String sceneName,
LoadSceneMode mode) (at
C:/buildslave/unity/build/artifacts/generated/common/runtime/SceneManagerBindings.gen.cs:98)

Of course, the OpenScene() method doesn’t have option for Additive flag.

How does Unity do this?

Use

 Application.LoadLevel (<Scene Name>);