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 namespace UnityEngine’. 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
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.
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!
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.