Build Setting Errors

Hi,#
using unity 5.6.0f3 and have come across the Application.LoadLevel problem. found the solution and it runs in debug fine.

However when i do the build and run i get this error in the console

Assets/Scripts/LevelManager.cs(4,19): error CS0234: The type or namespace name SceneManagement' does not exist in the namespaceUnityEngine’. Are you missing an assembly reference?

Assets/Scripts/LevelManager.cs(6,29): error CS0246: The type or namespace name `MonoBehaviour’ could not be found. Are you missing an assembly reference?

Error building Player because scripts had compiler errors

.cs is as follows

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelManager : MonoBehaviour {

// On CLick button - Loads scence from event manager using the LoadLevel + name function below
public void Loadevel (string name) {
Debug.Log("Level load requested for: " + name);
SceneManager.LoadScene(name);
Debug.Log ("Loaded Level " + name);
}

// on click Quit
public void QuitLevel (string name) {
Debug.Log (“I want to Quit”);
Application.Quit (); // no use in Web build, Debug. Mobile ios, android, windows frowned upon!
}

}

any one else had this error? google isnt helping me much

thanks

Got this very same issue as well. Need help.

Solution.
Install unity 4.6

Builds straight way and run. dual install.

Unity Archive 4.x

Hoping the course will then upgrade to 5.x and answer the build error problems later on

That isn’t a solution. This basically means I cannot make my own games on 5.6 until they come around to tell us how to fix it. This is affecting all my games currently. I can’t build to PC standalone.

Going back to 4.6 means I can’t use the new features in 5.6.

@Motion / @Daniel_Ray,

  • are you using Visual Studio or MonoDevelop as your IDE?
  • how many versions of Unity do you have installed?

I now have unity 4.6 and 5.6.0f3 installed.
Once I installed 4.6 I had no build problems at all.
using monodevelop

@Daniel_Ray your right it isn’t a fix but it is a solution to the current problem. Im gutted to as id like to use the newest version and get straight in. Using 4.6 is just taking us through the basics of c# I expect and hopefully it will all become clearer further through the course!

SceneManagement was introduced in 5.3 or 5.4 I believe.

I wpuld start by checking the short cut icons that you are using to launch Unity and check that they are actually pointing to the expexted versions.

Also, PC or Mac?

Anyone still wondering to this question or finds this page. If VS doesn’t understand the project, aka “Monobehavour not found”. Try creating a “dummy/empty” script in unity. Open it from unity and it should load the correct extensions and should be working again. you can then delete the empty script and carry on. Ive gone through this issue twice now with two different versions of vs on different computers and it works every time.

Privacy & Terms