- Home /
Why do i get error that level is not in build settings when i can see that it is in multiple ways?
Specifically I get the error message:
Level '' (1) couldn't be loaded because it has not been added to the build settings. To add a level to the build settings use the menu File->Build Settings...
This appears in the debug output in Xcode /only/ for the iOS build of our game. Every other platform build does not have this problem and successfully loads the level. I can see the text data in ProjectSettings.asset is correct and the 'Build settings' UI also has a level number 1 which is the correct level.
Aside from the error not occurring on other platforms the content of the scene in question are loaded and used correctly on these platforms.
I have cleaned out the library and temporary files to the best of my ability... does anyone have any suggestions as to what I might have configured wrongly to achieve this? There is no indication of a problem during the build process - only when running on a device.
Annoyingly - as an aside - the builds work okay in other respects, minus the functonality included in that scene, except on the original iPad mini which hard crashes about the time I expect to see this error in a debug build.
This smells of a bug - at the least because everything works correctly on all other platforms I can test on. The contents of ProjectSettings.asset should be respected regardless as to any temporary data, caches or bad defaults...
EDIT: I have now tested this on a clean machine and am able to reproduce the problem. I am raising a bug for this - in the meantime I will try using the string form of the function as workaround.
EDIT: I have now tried the string version of the function and instead I get this 'complimentary' error message - but it also works correctly on all other platforms:
Level 'bg_music_additive' (-1) couldn't be loaded because it has not been added to the build settings. To add a level to the build settings use the menu File->Build Settings...
EDIT: A crucial omission in the original question is that I am using LoadLevelAdditiveAsync. It turns out that LoadLevelAdditive works fine - if not asynchronously.
EDIT: Bug raised - Case 597310. I have suggested a simple mitigation of making the error message accurate - something like: "LoadLevelAdditiveAsync does not work correctly for iOS - use LoadLevelAdditive instead" so this becomes trivial to identify and workaround until a real fix is provided (if ever).
EDIT: Another bug is that LoadLevelAdditive only works under iOS with the indices and not the scene name (which works under Android, Windows Desktop, Mac OS X)
Are there any funny #ifdef IPHONE
directives? Could be something there is knocking things loose. You're currently using LoadLevel(int)
? I want to say LoadLevel(string)
could have been trying to load level "space-1" somehow.
There are no #if directives in that area of the code... regardless this is really a data problem and not a code problem. I am quite thoroughly convinced that this is a genuine bug and am searching for any kind of workaround now... next up I am planning to remove the 'Async' only for iOS and live with the hitch.
Is it only for level 1? Do levels 2 and 3 also fail?
Does it fail on a dummy project, 3 stub levels and one 20-line script with a button to load each? Huge pain. But ideally, that $$anonymous$$imal test succeeds, and you "only" have something corrupt, but fixable.
I've wasted enough time on this already and I'm in a bit of a crunch. There is sufficient evidence that this is a bug... I might revisit this if the devs are too busy/lazy to do their job in the meantime.
Answer by BAIZOR · Feb 02, 2016 at 05:31 PM
I had similar problem. My solution is to check EditorBuildSettings.asset and fix mistakes in it. Some times unity put wrong characters.
For example my scene has name "Church". Unity changed the name in the file to "\u0421hurch", then can't find scene with name "Church", because it isn't exists.
how do you "check" EditorBuildSettings.asset? I keep getting an error saying a scene isn't in my build settings when it clearly is
Answer by Max_Bol · Sep 26, 2017 at 11:51 AM
I just faced this issues and the way I used to fix the problem is to clear the Build Settings' scenes and add them back in.
There seems to be an issue where moving the scenes files in a different newly created folder might not be updated in the Build Setting internal paths. In my case, I had to reorganize the folder containing the project's scenes as it was becoming a real mess. After, I started getting error from the Build Index where, for example, it tells me that Build Index (1) is missing and I have to add it into the Build Setting (while I had over 30 scenes in the build setting)
Removing (select & delete) then add it back fixed the issue.
Your answer
Follow this Question
Related Questions
Having 10 Levels in 1 Scene? 1 Answer
New scene for minigame or not? 1 Answer
Unity alters my launch images 1 Answer
iOS build is including Mac OSX .bundle files into Xcode Project 2 Answers