- Home /
My button won't load a scene
When I click my button it calls the function that is assigned to it but the line that loads the new scene doesn't load the scene.
public void MyTeams(string levelName)
{
// execute the "My Teams" screen, where the user can manage their teams and create new ones
Application.LoadLevel (levelName);
print (Application.loadedLevel);
}
I have "levelName" defined as "MyTeams", which matches the name of the scene exactly. The print line prints the loaded level just fine every time the button is clicked but the scene won't load. The scene is in the build settings. The script is attached to an active gameobject. Everything is set up but it wont work. Please help!
Hi,
Is the scene you want to load in the list of scences to build (and ticked) ?
yes, i mentioned in the description of my question its already in there
Answer by dreg_master · Oct 26, 2017 at 10:45 PM
Hi there, @whendon Make sure you have your Scenes setup in the File --> Build Settings.
"The scene is in the build settings" clearly stated in the question