- Home /
"Classic" namespace "UnityEditor" error
Very beginner here. All I have in mind is to make a little sprite move. I know Java pretty well, though I'm pretty new to JavaScript
So I made this code, which I think is correct.
pragma strict
var healh : int = 100;
var speed : int = 5;
function Start () {
}
function Update () {
if(Input.GetAxis("Horizontal")){
Transform.Translate(Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, 0, 0));
}
}
But whenever I try to debug it, I always get the "Namespace 'UnityEditor' not found, maybe you forgot to add an assembly reference?" message. Like any sane person, I asked google what I should do. After a good deal of searching, I didn't find any answers.
From what I gathered, a bug in the Mono editor caused this, but that was nearly 2 years ago. It can't possibly be still around.
Anyhow, any and all help is appreciated.
Are you trying to build a debug build from within mono developer?
Answer by GuyTidhar · Mar 17, 2013 at 02:33 PM
Try adding
import UnityEditor;
Right after
#pragma strict
Although it should be added by default.
Are you sure this script is the reason for this error?
I tried that, and now I have 2 errors.
I'm just running the debugging process, trying to get this error free.
As Sarper Soher suggested - you shouldn't build the debug build from within mono developer.
It is not relevant for work with unity.
If you wish to debug, once you regularly run the game, you need to attach the debugger to your running instance.
Look for:
"Run -> Attach to process"
Then select the unity editor.
Alright, what should I do ins$$anonymous$$d to make sure my code is syntactically correct?
You need to check the unity console:
CTRL + SHIFT + C, if it is not opened.
There you get all warnings, errors (wrong syntax and exceptions), and debug logs.
You can focus away from the editor and back in order to refresh and make unity compile your latest changes.
(notice the right bottom processing icon that animates when unity compiles your changes).
Also, double clicking the specific error lines you get in the console, should pop the code editor on the corresponding line at which the error or log are happening.
Answer by Ben Blaut · Mar 20, 2013 at 07:55 PM
It seems the method for debugging using MonoDevelop has changed with the latest upgrade to 4.1. Before, you could build and run from Mono to debug with breakpoints, but it appears you no longer can do this using the simple "Build" and "Debug" buttons in Mono.
To do so now, you have to use "Attach to Process" on the toolbar or in the "Run" menu, and attach it to the Unity Editor. Now, when you hit play in the Editor, it will bring you to Mono so you can step through from your breakpoint.
Answer by mateiasu · Jun 23, 2013 at 03:44 AM
Hi together!
I also had similar problems and found the solution with this post http://answers.unity3d.com/questions/419565/unity-41-javascript-compile-unityeditor-not-found.html?sort=oldest.
I provide a small binary (Windows) which watches and fixes related project files.
https://bitbucket.org/mviranyi/unity-patches/downloads
Hope it helps :)