- Home /
Unity build not loading correct scene 0
I have exactly one scene in the build settings, that being the scene that is currently open. When I build, however, a completely different scene is built. I know how Unity works, I've been using it for years, so it's not because my build settings are wrong or because I accidentally added the incorrect scene to the build.
I've tried building multiple times for different platforms, I've restarted the engine several times and I've restarted my computer, so I'm not sure what else I could do. It makes working on scenes feel worthless as I wouldn't be able to build them.
If it makes a difference, I used the "delete" key to remove the scenes from the build settings and one of them could have been active(checked) while I deleted them, which may be the cause of the problem. I'm not sure how I'd go about fixing this issue if this is, in fact, my problem.
Any help or suggestion would be greatly appreciated.
Turns out the results vary depending on the way the build is opened. If I rick click to chose to run it with a specific gpu, the game will run the wrong map, but if I just double click to open the program, it will run the correct map. I've never had this problem before, and it's so strange.
Answer by Chris100100 · Apr 10, 2016 at 12:17 AM
I tried updating and reinstalling Unity with no luck, leading me to believe that it was an error with the build settings in the project itself. After exporting all of the assets into a package and making a new project and importing the package again, everything worked.
What might have happened was that I tried to remove the list of inactive scenes from the build settings by pressing the delete key and doing that might have caused an error. So if this ever happens to everyone, this is a workaround to fixing the problem. You'll need to reset all of your tags and layers, but afterwards, everything will work as planned!
Answer by nkmxzhang · Feb 18, 2016 at 11:39 AM
try to print build setting scene.
for(int i = 0; i < EditorBuildSettings.scenes.Length; i++) { Debug.Log (string.Format("scene {0} enabled: {1}", EditorBuildSettings.scenes[i].path, EditorBuildSettings.scenes[i].enabled)); }
I'm not sure I understand, how would I go about doing that?
I means maybe you can output EditorBuildSettings.scenes content in scripts to get more useful information.
It turns out that exporting all the assets as a Unity package and importing them all into a new project fixed the problem.
Answer by Mobazy · Jul 06, 2019 at 02:55 AM
File --> Build Settings.
Right Click Scenes not loading --> Remove Selection.
Drag Scene Back into position.