4.1 Javascript compile - 'UnityEditor' not found

After upgrading to 4.1 this morning, MonoDevelop is reporting the following error for all javascript files in my project: “Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference? (BCE0021) (Assembly-UnityScript)”. I don’t use javascript primarily, so the error is limited to about a dozen third party files, but they’re from multiple third parties, and they all worked fine pre-upgrade. There are no errors reported by the Unity console; these are only showing up in MonoDevelop.

UnityEditor is properly referenced in the project assemblies. Dropping and re-adding it doesn’t help. Adding an import reference to the javascript file doesn’t address the issue, either. I don’t see anything obviously wrong. Any thoughts or help would be appreciated.

Whereabouts in your project are the files? What folder hierarchy are they under?

In all cases, these are 3rd party files and are part of their original working folder hierarchy. They were dragged in to my project root and typically follow a path structure something like this:
“<ThirdPartyName>\Scripts<filename>.js”.

These are not editor specific files (i.e. there is nothing in them that would require them to be in an “Editor” folder).

I’ve got the same issue, with the FirstPersonCharacterController from Standard Assets. I imported it prior to 4.1 and have this problem in MonoDevelop after upgrading.

  1. Deleting the reference to UnityEditor.dll from the assembly fixes this.
  2. Deleting the entire assembly also fixes this.

Syncing the MonoDevelop project will add UnityEditor.dll back again, but you can just remove it again.

Not sure what causes this bug in the first place - the above is a workaround, not a fix.

Thanks.

I’ve been using more or less the same workaround - I just removed the “UnityScript” projects from MonoDevelop rather than the assembly reference, since I’m not editing any UnityScript files. But, as you said, they come back whenever Unity syncs the project and the process has to be repeated.

I’m hoping somebody out there still has a fix up their sleeve.

yea I am also running into this issue, currently i have to isolate working files to code.

I also have this problem. Also trying to go around the issue has eventually scrambled my project files somehow. There was an earlier Unity update that had similar problems.

Hi together!

I also had these 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/UnityBCE0021_20130623.zip

If it down you can try the repo directly:
Bitbucket

Hope it helps :slight_smile: