I am having trouble getting Application.LoadLevel to load scenes as part of an Editor script. To test it out I added a simple command as a Editor menu item. In the test project I have the scenes have been added to the Build
Settings, and the command is definitely executing via the menu as the Debug message appears in
the console, however the scene is not loaded until I click (once) on a
script in the Editor folder (as listed in Project View ).
Is this command supposed to work like this in the Editor?
The script is shown below and is placed in the Assest/Editor folder.
thanks for any help,
Richard
class LoadLevels
{
@MenuItem ("Custom/LoadLevel1")
static function LoadLevel1()
{
Application.LoadLevel(1);
Debug.Log ("Added Level 1");
}
}
Many thanks Ntero - EditorApplication.OpenScene() worked perfectly. Unfortunately, I then tried EditorApplication.OpenSceneAdditive to combine the current scene with another scene and OpenSceneAdditive did indeed combine the new scene but it added it twice! Thus basically I end up with three scenes loaded - does this sound like a bug to you?