Scene IS added to build settings: "Scene couldn't be loaded because it has not been added to the build settings"

Hi everyone,

I am getting the error “Scene couldn’t be loaded because it has not been added to the build settings” despite the fact that the scene IS in the build settings, and ticked.

My code to load the scene is as follows:

void genericLoadScene(string sceneName, List<string> parameters)
{
	SceneManager.LoadScene (sceneName+"");
}

As you can see by the presence of sceneName+“”, I am definitely passing it a string, not a variable name.
The error occurs with specifically this scene. All other scenes work fine.

62590-screen-shot-2016-01-25-at-152122.png

I have checked the string that I am passing in to ensure it is correct many multiple times.
What am I doing wrong, please?

I have tried reordering the scenes

try loading it by number instead of the name.

If you already implemented. you can store there email or id inside your app and use that as your identifier. right?

7 Answers

7

TIP: If it is not about whitespaces, then it might be that you have move your scene to another folder in the hierarchy. Build Settings seems to adapt this new folder, but you actually have to re-drag your scenes into the Build Settings, else you will have this error also.
Just a tip if you happen to meet this issue again later when you are sure there are no spaces and spelling issue.

Yeah, my case was solved by dragging the scene again to build settings, I moved it to another folder and probably lost reference or something!

Thanks OneCept-Games, I encountered this issue after reorganising my projects folder structure.

Yup, just had exactly this issue. Annoyingly, it turns out that the moved scenes will work perfectly fine in builds but won't be found correctly in the editor, which lead to a lot of confused frustration. Definitely an editor bug.

hello. did you find the answer?

After having iterated through all characters in the two strings, I have found the answer! Unfortunately, my scene had a space in it; although, it wasn’t a ‘proper’ space, as in unicode 32. In fact, it was unicode 160; a non-break space.

Note for the future: Don’t use spaces!!

I would have suggested copying and pasting the string from the .unity asset to the class just to make sure they're the same.

I was having the same issue and this answer is what pointed me in the right direction. I used the String.Trim() to eliminate the wild symbols from beginning and end of the scene names.

@doopp, how can i get their id? because I am not using any service from Game Center.

Actually…(I just ran into it after getting my own Collaborated project from one system to another), it has to do with the fact that the project doesn’t seem to like the items already in the list in the Buildscreen. Easiest is to remove all scenes and add them again. No need to change the code. The project will then be able to find the items again.

One issue I’ve learned is that when you take the name as a string from another object… if the object is a texture file (maybe others as well), it may associate that to the name. I learned this because I manually added the name of the file and it worked, yet when I try it with the string, the debug.log description has (UnityEngine.Texture2d) attached to the string output. Still trying to find the right solution for that, but I’m sure it won’t be long before I do. Good luck!

There is no unique identification exist for iPhone devices. So we can use generated device token of identifying purpose though it get expired when user install app again and new device token get generated. So we require to track this at server side :)

This Helped Me! Thank You!

ok. I got you. thank you for your reply!

I moved the scene to another folder and then it worked.

it happened to me aswell if your scenes are in a folder try including the folder name for it to work also dont forget to add your scenes in the File/Buildsetting :

the following code should be smt like this :

public void GotoLevelSelect()
{
SceneManager.LoadScene(“Scenes/LevelSelect”,LoadSceneMode.Single);
}