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)
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.
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.
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”);