- Home /
Application.LoadLevel overwrote my scene?
I created a Menu option to run a script where I just call Application.LoadLevel() to my first scene, so that I don't have to always open it when I test. When I call this script for a scene other than the one I have loaded and I'm not in play mode, Unity overwrites my current scene entirely with a copy of the scene I was trying to load. Can someone explain this behavior? Am I missing something?
Answer by supernat · Mar 20, 2014 at 04:22 PM
Because the LoadLevel method is called in an Editor script (you said it was a menu option, so I assume you placed it in the Editor folder), whatever you would normally do in-game can be done in-editor. So you're telling the editor to load all of the objects from a particular scene, and I'm guessing you actually want to change scenes, not overwrite your scene. If so, see here: http://answers.unity3d.com/questions/176670/load-specific-scene-in-editor.html
Thanks for clearing this up, I now understand. And thank goodness for version control, this could have been really bad!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Endless DeathZone??!!? 4 Answers
Reloading the scene causes ads to reload. Is this ok ? 3 Answers
Load scene when colliding on GameObject 1 Answer
Multiple lightmaps / 1 scene 1 Answer