Scene not in build settings ERROR! Please help

Here’s the error:

Level ‘Scene_menu’ (-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…
UnityEngine.Application:LoadLevel(String)
Leader_Boards:OnGUI() (at Assets/Scripts/Menu scripts/Leader Boards/Leader_Boards.cs:17)

Here is my build settings

I’m trying to load the main menu after I go to a different screen.

Here is my Script:

using UnityEngine;
using System.Collections;

public class Leader_Boards : MonoBehaviour {

	void OnGUI () {
						// position left/right, position up/down, size left/right, size up/down

		//GUI.color = Color.red;
		//GUI.backgroundColor = Color.green;
		GUI.Box (new Rect (7.5f, 7.5f, 1130, 50), "Score");
		GUI.Box (new Rect (7.5f, 7.5f, 200, 50), "Put in the text here!!!!");  // leader board

				GUI.Box (new Rect (7.5f, 60, 1130, 50), "1st Place"); // Place #1

		GUI.Button (new Rect (2, 558, 175, 50), "Back To Main Menu"); // loads Main Menu
		Application.LoadLevel ("Scene_menu");
		}
}

This is the only error. I’m brand new to the whole BUILD SETTINGS thing.

Not entirely sure, but you may need to include the directory in your LoadLevel name, like:

Application.LoadLevel ("Scenes/Scene_menu");

Since normally Unity looks in the top directory (Assets) for scenes, and it’s not finding it since you have them placed in a subdirectory.

"Scene_menu" vs "Scene _menu"
1 Like

try it with level id

Applocation.LoadLevel (3);

I’ve tried all three of your solutions and none of them worked . :frowning:

Have you hit Save Project yet?

I have saved both my Script and my project/ scene.

Does anyone else know? I have not figured it out yet.

KyleOlsen is correct - your unity file is named “Scene _menu” but you’re trying to load “Scene_menu” in your code. It has nothing to do with your build settings.

1 Like

I don’t know how to code the “Scene_menu” vs “Scene_menu” I’m pretty new to coding. I don’t know how to implement that function.

The string that you are passing to Application.LoadLevel doesn’t match the name of the unity file in your project.

1 Like

So I would write the code like this?

using UnityEngine;
using System.Collections;

public class Leader_Boards : MonoBehaviour {

	void OnGUI () {
						// position left/right, position up/down, size left/right, size up/down

		//GUI.color = Color.red;
		//GUI.backgroundColor = Color.green;
		GUI.Box (new Rect (7.5f, 7.5f, 1130, 50), "Score");
		GUI.Box (new Rect (7.5f, 7.5f, 200, 50), "Put in the text here!!!!");  // leader board

				GUI.Box (new Rect (7.5f, 60, 1130, 50), "1st Place"); // Place #1

		GUI.Button (new Rect (2, 558, 175, 50), "Back To Main Menu"); // loads Main Menu
		Application.LoadLevel ("Scene_menu" vs "Scene_menu");
		 
		}
}

No, the problem is that you have an (I guess accidental) space in Scene_menu, making it Scene _menu. Either rename the scene to Scene_menu, or rewrite the code to Application.LoadLevel (“Scene _menu”);

1 Like

It’s fixed. Thanks!!