Udated to 3.4.1 and got Namespace errors

I have just updated to the new Unity Editor and have got the following errors:

\Assets\Standard Assets\Character Controllers\Sources\Scripts\ThirdPersonCamera.js(1,1): Error BCE0021: Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference? (BCE0021) (Assembly-UnityScript-firstpass)

\Assets\Standard Assets\Image Effects (Pro Only)\DepthOfField.js(1,1): Error BCE0021: Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference? (BCE0021) (Assembly-UnityScript-firstpass)

Any ideas?

it all worked before i updated

I have the same issue:

There are now 12 errors in my mono project. All of them related to the missing “UnityEditor”.

Example:

\Assets\Standard Assets\Image Effects (Pro Only)\BloomAndFlares.js(1,1): Error BCE0021: Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference? (BCE0021) (Assembly-UnityScript-firstpass)

D:\AlienSpidyProject\Updated\Assets\Standard Assets\Scripts\JoystickJS.js(1,1): Error BCE0021: Namespace ‘UnityEditor’ not found, maybe you forgot to add an assembly reference? (BCE0021) (Assembly-UnityScript-firstpass)

Thanks,

Has anyone got any fixes for this?

try adding

import UnityEditor;

at the top of said files

Doesn’t work. It’s like the UnityEditor.dll assembly reference in MonoDevelop has some path issue or something.

If you are not using Editor scripts you can delete the reference to UnityEditor.dll from your assemblies to get your other scripts compiling in Monodevelop, but it is painful as you have to do this every time you make a new script/sync project/restart.

Reference issues in monodevelop don’t touch unity at all though (as you can’t compile unity applications from there you can ignore them unless you need the autocomplete), the only impact auto complete on the MD side

For that lose of references and thus auto complete, indeed a “sync monodevelop” is required each time, nothing to do about there.
but for me it happens pretty rarely compared to the number of switch forward - backward and changes

Yes correct, in Unity everything is fine, the problems are in MonoDevelop.

Plenty of people use MonoDevelop “F8” to compile and test for bugs instead of clicking back to Unity after saving, which used to work but now gives errors and stops the compile.

I don’t. After using it long enough you learn to misstrust it, just cause its fine by MD and as per the Mono version for which the checker was written (in case of Boo and C# where the plugins exist in MD without the custom unity version already) does not mean anything.
Also with autocomplete you should write significantly less crap than when using Unitron :wink:

Also if you want to prevent it from happening regularly, stop modifying code when unity is in play mode cause thats the time when it normally breaks for me.

Not all of us have your level of error-free code entry :slight_smile:

Compile in MD works well (before 3.4 at least) and the workflow enhancement is significant - instead of save/switch to Unity/double click on the error, you just press F8 and it shows all your errors in MD.

In the rare case that results differ, when you eventually click back into Unity it tells you what is wrong anyway so I don’t get the mistrust. If we are using it for debugging, is it too much to expect it to compile?

Anyway, this is not really helpful to OP, just wanted to say that there are others that are frustrated by this no longer functioning, and looking out for a solution beyond “don’t use it”.

You can use it and if you do what you should, ie stop play mode before going to code editing, it will normally also not mess up the project.
I so far only got the messups when I accidently went editing code in play mode.
Unsure if its a bug due to this relationship, might as well be on purpose to prevent users from reporting bugs resulting from the missthinking that you can recompile full assemblies while they are in use without fucking up the whole environment :wink:

and I don’t see how debugging is related to compiling, because attach to process, which you use for debugging (please don’t tell me you use run to debug directly on a debug editor … ;)) does not require the presense of a compiler at all.

Sorry, I think you are misunderstanding the issue here - no one is talking about losing references or messed up projects, simply saying that MD does not compile .js files anymore without throwing errors, which breaks a time-saving workflow. Try this:

Make a blank project. Import a simple .js such as SmoothLookAt.js. Sync Project, and in MonoDevelop hit f8. What worked in 3.3, were warnings in 3.4, and are now errors in 3.4.1.

If you can make that work several people would love to know how…

Apologies, my comment was based on ignorance about how the debugger actually works. Yes, I use attach to process. :slight_smile:

Oh … hmm normally stuff that went from not warning to warning to compile was on purpose with the upgrades in the js compiler to enforce compliance to the pragma level choosen to ensure that pragma strict works the same on mobile.
But those enforcements appear on MD and Unity then, not just MD …

Out of ideas there then (and I know why I use a language with millions of user and a global standard, not a language thats still imature and trying to reach Boo and C#)

Hehe yes I am using c# as well, it is just all of Unity’s .js image effects and character controllers etc that give these errors and break my c# compiles.

those interestingly don’t cause me problem.
Sure you reimported the image effect etc packages that came with 3.4.1?

That being said: I never open the normal solution. Unity generates two, the normal sln and the -csharp sln and I by definition only open the later, cause the code completition doesn’t work reasonably on UnityScript, it does not work at all in VS and beside that it doubles the number of projects from 3 to 6 inside the sln → nope for sure not, I can only lose :wink:

Yep, see my example earlier in the thread with an empty project and a single .js. Same errors in MD regardless.

This I didn’t know; I have just been using whatever comes up with the “Sync Project” option.
Opening the -csharp.sln seems to be a very good workaround for me, thank you!

This really is not helpful on a debugging level and to follow memory leaks. Unity should really of checked all this before sending out an update that stops people working with an environment they are use to. This is causing me a head ache and i hear Unreal calling

Can you run Visual Studio to debug Unity?

For any interested, I received a reply from Unity regarding the bug I entered about this. :slight_smile:

I ran from the csharp sln and I can debug Awesome…

I dont need to debug all the time but sometimes brainlock requires me to do so…

My solution is put all scripts into “Standard Assets” folder. I had problems with 2DToolkit, that unity and mono develop not recognized their tk2d* classes. Transfer all of them to stdassets solve that!.