unity 3.4.1f5 namespace error

Right after installing 3.4.1f5 I’ve got message “Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference?” error when compile the project.
This error is present in Standart Assets scripts only (CharacterMotor, camera scripts etc).

Bug in 3.4.1f5, they say they will update it in the next patch…


Temporary solution in monodevelop should be:

  1. to go to the solution panel on the left,

  2. open assembly-Unityscript->references,

  3. and delete all references BUT the “UnityEngine.dll”.

Will reset if you close monodevelop again, and not very stable imo, but at least it gives you a sort of “thumbs up” if it works by giving you some other errors :wink:

If you look in the script files that are in error, do you see a line at the top that says “using UnityEditor;”? Or do you have code that uses any class from the UnityEditor library?

You might know this but in case you don’t… You cannot use the UnityEditor classes except from within the “Assets/Editor” folder. Those classes can only be used in the editor, not at runtime.

If you do see that line, then remove it. If you have classes that come from that library, you must remove them as well from your code. Alternatively, you can move that class file into the “Assets/Editor” folder.

I guess the problem is that UnityScript automatically includes the UnityEditor namespace by default. That’s usually not a problem. As long as you don’t use anything from that namespace you just get some kind of “not used namespace” warning which should be disabled for UnityScript.

Beside the “using Bla;” in C# and “import bla;” in UnityScript the assembly that contains this namespace have to be added to the project. In the case of UnityEngine and UnityEditor that are “UnityEngine.dll” and “UnityEditor.dll” That is usually done automatically by Unity when you sync the solution.

Maybe they changed something in the last update, you can try to delete the .sln and .csproj files from your project directory and re-sync your project in Unity. If that doesn’t help there might be a problem in this Unity version. If that doesn’t fix the issue you should file a bug report so the Unitystaff notice the problem.

I had the same problem when upgrading to the new unity version. Directly running from MonoDevolop doesn’t work anymore but starting unity and attaching MonoDevelop does work!


  • start Unity
  • MonoDevelop: Run → Attach to process…
  • set breakpoints and Start your scene.


Downloaded unity on my new windows 7 64-bit computer, I get the error:

“namespace ‘unityeditor’ not found, maybe you forgot to add an assembly reference? (BCE0021)”

even when starting a new project and attaching a simple script to a cube. This issue is CRIPPLING to my design schedule; I need to sort out what is happening asap!

Try deleting all the .csproj and .sln files in the project folder and then synch monodevelop project by right clicking on the script and select synch monodevelop project.
this worked for me atleast.

The same here. Windows 7 64bit, MonoDevelop.

If i add an EMPTY C#, called whatever you want, wherever you want, on my pc (and not at work for example), at compile time, Modo prompt me “Namespace UnityEditor not found. Maybe you forgot to add an assembly reference? (BCE0021)”. And it prompt 19 errors, all in other javascript file not written by me (specifically the Detonator pack and some standard javascript that comes with Unity).
This is crazy, i don’t know what to do (except to convert all code to c#).

alt text

Just delete in the project/assets/standard Assets/particles the “legacy particles” folder.
Worked fine for me.

(You should take care, not to use anything from this folder)

just delete in the assets folder the “legacy particles” folder.

This is still a problem in 4.1.

  • new project
  • add a single new blank script
  • namespace error when you try to compile


This could have happened because of a UnityEditor reference in the .unityproj files.
See this post if it occurs again: Unity 4.1 Javascript compile - 'UnityEditor' not found - Questions & Answers - Unity Discussions