Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by jmcclure · Mar 18, 2013 at 05:36 PM · javascriptcompile-error

Unity 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.

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.

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Daveoh · May 23, 2013 at 05:27 PM 0
Share

I have just got this problem upgrading from 4.1.2f1 to 4.1.3f3.

avatar image whitething · May 24, 2013 at 06:41 AM 0
Share

Same issue here, after upgrading to 4.1.3f3

avatar image Turcca · Jun 03, 2013 at 10:34 AM 0
Share

Same problem, after upgrading to 4.1.3f3.

avatar image RKSandswept · Jun 12, 2013 at 03:40 AM 0
Share

The solution that worked for me was the advice below, don't build in $$anonymous$$ono. Ins$$anonymous$$d run $$anonymous$$ono and the Unity Editor. Then in $$anonymous$$ono select Run->Attach to Process You should see the Unity Editor. Once attached just use the run arrow (top center in the Unity Editor) to run and such. $$anonymous$$ono breakpoints then work fine.

avatar image Zeblote · Jun 23, 2013 at 03:25 PM 0
Share

Why does this have 2000 views, do you really need to use a bot?

Show more comments

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by whydoidoit · Mar 19, 2013 at 03:00 PM

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:

   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.XML" />
     <Reference Include="System.Core" />
     <Reference Include="UnityEngine">
       <HintPath>/Applications/Unity 4.1/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll</HintPath>
     </Reference>
     <Reference Include="UnityEditor">
       <HintPath>/Applications/Unity 4.1/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll</HintPath>
     </Reference>
   </ItemGroup>

Be aware that using MonoDevelop to build your project has the following limitations:

  • MonoDevelop is often out of sync with the Unity build process so there are several things that will not compile that are actually fine.

  • MonoDevelop build is not the build path for your final executable

  • You don't need to build using MonoDevelop in order to debug your code using MonoDevelop. See this link.

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jmcclure · Mar 19, 2013 at 03:59 PM 0
Share

Thanks for your advice. I'm aware of workarounds and I have no trouble switching back and forth to Unity to see if there are any actual errors.

That said, I spend quite a lot of time in $$anonymous$$onoDevelop and it is often a faster workflow to debug multiple errors in one place. When it is just one error, switching back and forth is trivial, but when it is more than that and you have to wait for assets to import and/or compile each time, that workflow quickly become less attractive.

What it boils down to is that there's a bug in compilation that was introduced sometime after 4.0 and I'd really like a fix rather than a workaround (since I already have those).

avatar image whydoidoit · Mar 19, 2013 at 04:08 PM 0
Share

Sure, better report it to Unity Support - but I wouldn't hold my breath. They took forever to fix the default parameters issue - though this one is a bit closer to home by the sound of things.

Not sure why you'd get an asset import switching between $$anonymous$$D and Unity after editing a code change and the script won't compile until you save it (this is my work flow on a massive project and I find it much faster).

avatar image whydoidoit · Mar 19, 2013 at 04:10 PM 0
Share

Do you not find that Unity also compiles the project as well as $$anonymous$$D? Always seemed to for me. Now my $$anonymous$$D is set to not build under any circumstances so I haven't checked for a while.

avatar image jmcclure · Mar 19, 2013 at 04:32 PM 0
Share

Yes, Unity builds everything fine. That's actually in my original question - This is a $$anonymous$$onoDevelop only issue.

Adding class files from $$anonymous$$onoDevelop causes Unity to import them, which then re-synchronizes the $$anonymous$$onoDevelop projects and reintroduces the javascript errors from the projects I had previously removed. It's quite annoying.

I get your point: don't use $$anonymous$$onoDevelop for any compiling. That's a workaround, and one I might have to adopt. $$anonymous$$eanwhile, I'm going to hope for somebody who has found a fix.

avatar image GameDevBryant · Sep 01, 2016 at 02:49 PM 1
Share

@EthanFischer, Visual Studio uses breakpoints as well. That used to not be the case in previous versions but I frequently use VS to debug code with breakpoints and stepping over/into etc.

You just use the "Attach to Unity" button in Visual Studio that you can install with the Unity installer. This button is available if you have a Unity project open in Visual Studio alt text

capture.png (8.1 kB)
Show more comments
avatar image
1

Answer by mateiasu · Jun 23, 2013 at 01:34 PM

For me it was solved by deleting from :

  • Assembly-UnityScript.unityproj

  • Assembly-UnityScript-firstpass.unityproj

the UnityEditor related ref tag:

 <Reference Include="UnityEditor">
   ..
 </Reference>

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:

https://bitbucket.org/mviranyi/unity-patches (UnityBCE0021)

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GameDevBryant · Jun 28, 2013 at 03:57 PM 0
Share

thanks a lot! this one helped me, although i did not have the "Assembly-UnityScript-firstpass.unityproj" file, only the "Assembly-UnityScript.unityproj" file.

avatar image mateiasu · Jun 28, 2013 at 04:25 PM 1
Share

You're welcome! Assembly files depend :) Therefore I added the config file so you can define yourself what file should be patched. This wasn't there before 0.1 of UnityBCE0021.

avatar image
0

Answer by Dougbott · Mar 19, 2013 at 07:27 AM

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.

Try and add this.

 import UnityEditor;

Good Luck.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jmcclure · Mar 19, 2013 at 02:11 PM 0
Share

Thanks, but I've already tried that. That's what I meant in my original question by "adding an import reference to the javascript file doesn't address the issue".

I've worked around the issue by removing the "UnityScript" projects from the $$anonymous$$onoDevelop solution. They come back every time Unity synchronizes the projects and then they have to be removed again. It keeps me working, but it's no solution.

I'm guessing this problem must only be impacting a handful of people or there'd be a bigger outcry.

avatar image rbgamer · Jun 24, 2013 at 03:30 AM 0
Share

Within the Assembly browser I found within the UnityEditor "Can't load:" ISHapeCode.NRefactory, Verion=3.2.1.6466 UnityScript, Version=1.0.0.0 $$anonymous$$ono.Posix, Version=2.0.0.0 nunit.framework Version 2.6.0.12051 $$anonymous$$ono.Cecil Version=0.9.5.0 and UnityEngin, Vesion= 0.0.0.0 $$anonymous$$y question is does this jump out as a flag to anyone?

avatar image
0

Answer by Turcca · Mar 20, 2013 at 08:16 AM

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.

"

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image whydoidoit · Mar 20, 2013 at 09:22 AM 0
Share

Open the .unityproj files for the JS projects in a text editor - find the < ItemGroup> section and delete the entries there. Backup first :)

   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.X$$anonymous$$L" />
     <Reference Include="System.Core" />
     <Reference Include="UnityEngine">
       <HintPath>/Applications/Unity 4.1/Unity.app/Contents/Frameworks/$$anonymous$$anaged/UnityEngine.dll</HintPath>
     </Reference>
     <Reference Include="UnityEditor">
       <HintPath>/Applications/Unity 4.1/Unity.app/Contents/Frameworks/$$anonymous$$anaged/UnityEditor.dll</HintPath>
     </Reference>
   </ItemGroup>
avatar image whydoidoit · Mar 20, 2013 at 09:23 AM 0
Share

Or you could try to fix them so that they point to the right place.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Sequence of function Calls 2 Answers

Renderer and Color are unknown to unity. Why? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges