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.
Does anyone know how to fix this?
NOTE: This may have come as part of 4.0.1, I upgraded from 4.0 to 4.1.
I heartily advocate not building your project in MonoDevelop - just let the Unity Editor build it for you by saving and bringing the editor to the foreground - it’s a faster work flow, although annoying to have to tab between the windows to see the next error. For ages there were things like default parameters that would build fine in Unity but not in MonoDevelop.
For reference you can open the Javascript .unityproj project files in a text editor and delete the references there, or modify them. (Backup first). You are looking for the < ItemGroup> section:
I wrote a small tool that does this for you automatically. This makes creating, deleting, moving scripts (almost anything that forces Unity to recompile and rewrite the unityproj files) possible again:
I have had the same problem… I have read that you could try and add UnityEditor and import it to the start of every problem javascript… Sadly this did not work for me. Maybe you’d have better luck.
There was a workaround for this, but I can’t delete the references:
"
If you have UnityScript files in your project and get the UnityEditor namespace
reference not found issue, go to the “Solution” panel (at the left of the
MonoDevelop IDE) and open the “Assembly-UnityScript → References” branch.
Delete all the references in there EXCEPT the one to the “UnityEngine.dll”.
Then press F8 again to build from MonoDevelop.
You should be good to go.
But clearly there’s still a bug somewhere causing this error.
I’m just glad I found an easy way around it.
BTW, everytime I reopen MonoDevelop I see those references added again.
So I have to delete them again. But when working on a project you rarely
close MonoDevelop.