"Scene couldn't be loaded because it isn't added to the build settings" but it is?

Objective:

To get the scene to change after clicking “Start” in-game

What Happens:

I get the following error:

Scene '' (-1) couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings...

Which is strange, because I did configure my build settings.

Here’s what my code looks like:

using UnityEngine;
using System.Collections;

public class LevelManager : MonoBehaviour {

	public void LoadLevel (string name){
		Debug.Log("Level load requested for: "+name);
		Application.LoadLevel(name);
	}

	public void QuitLevel ()
	{
		Debug.Log ("I want to quit!");
	}

}

What’s causing this error? Thanks in advance!!

1 Answer

1

Scene ’ ’ (-1) → The string is obviously empty, the compiler is looking for a scene called ‘’, hence you get the error. Go to the part of the code where you call LoadLevel(string name) and check the parameter.

Hi @Fatestay if you are seeing this on a newly imported model, and you made sure to embed your material in the FBX in your 3D package. If so, my recommendation is to avoid the new Unity embedded material functionality by selecting the legacy method on the materials Location. The image upload seems to be not working so here is a [1]. ![alt text][2] [1]: https://drive.google.com/a/lightup.io/file/d/19DWltpUSbHwbNHlWXx0QLFCwTppZJIYC/view?usp=drivesdk [2]: https://drive.google.com/a/lightup.io/file/d/19DWltpUSbHwbNHlWXx0QLFCwTppZJIYC/view?usp=drivesdk