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
3
Question by iamananimal · May 20, 2013 at 08:21 AM · buildunityeditorcompilercompilingmissing script

Error building Player because scripts had compiler errors

Hi everyone

I have a problem building my game and I have no idea why. When it starts compiling scripts, the progress bar doesn't begin and I receive this error message:

alt text

"The type or namespace name "UnityEditor" could not be found. Are you missing a using directive or an assembly reference?"

When I clic on it, it creates a scripts in the Assets folder, pointing to the line 2:

alt text

I tried to delete scripts, prefabs, etc, but it still sends me this message. I use CameraPath and iTween add-ons, would it be possible that it cames from them?

Thanks for all the help I can get!

prblm.png (523.1 kB)
prblm02.png (165.3 kB)
Comment
Add comment
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

5 Replies

· Add your reply
  • Sort: 
avatar image
12
Best Answer

Answer by Graham-Dunnett · May 20, 2013 at 10:49 AM

You're going to need to fix the error. So, you're using UnityEditor, which means your script is an editor extension. That code is not available at run-time. (So, for example, EditorWindow is all about creating new window in, um, the editor, and you cannot do this at runtime.) If you refer to the documentation:

http://docs.unity3d.com/Documentation/ScriptReference/EditorWindow.html

you'll read:

"Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder."

So this reminds you that your script needs to be moved into a folder called Editor. (The build system knows that scripts inside the Editor folder are to do with extending the editor, so doesn't bother to try and compile them into the built application.)

Comment
Add comment · Show 8 · 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 iamananimal · May 31, 2013 at 04:11 PM 0
Share

I just realized that apparently we can't answer on our own question page since there's not the message that I wrote back then: even if I accepted your answer at the time, I also wanted to say thank you, you helped me a lot (especially since I was in a hurry and you answered really quickly) and I now keep that folder "trick" in $$anonymous$$d ;)

avatar image doomguy95 · Nov 02, 2013 at 10:13 AM 0
Share

HOLY CRAP! I HAD THE SA$$anonymous$$E ERROR AND YOUR $$anonymous$$ETHOD FIXED IT THAN$$anonymous$$SYOU SO $$anonymous$$UCH DUDE!

avatar image pranavgadamsetty · Feb 16, 2017 at 03:49 AM 0
Share

I have been stuck at this since 2 days. Thanks for the help. But, after I put my script in the editor file, i'm not able to add the script to a button. When I try to do it, it says "The script is an editor script". I have attached my script below. Please helplink text

solve.txt (493 B)
avatar image dmoral12 · May 15, 2018 at 06:36 AM 0
Share

thanks man, you are the the best

avatar image SkyGolem · Nov 09, 2018 at 07:34 PM 0
Share

which scripts? all?

Show more comments
avatar image
1

Answer by Arran2020 · Jul 30, 2020 at 11:58 AM

I was having the same problem however easily found a fix.

Go into every Script you have in that unity project and double check the first lines, the ones which say "Using UnityEngine" and "Unity System Collections". I had only added to these lines with a "Using UnityEngine.UI" however when I was going through ALL my scripts for that project I found that there a few extra ones there that weren't there when I started and I had not added (they added themselves there) , for example there was a "Using System Collections XMP" or something random like that. Simply delete these, save the script and you should be good to go.

I have no idea why they are there and what type of problem they seemed to cause however I can now build my project to android problem free now.

Comment
Add comment · Show 1 · 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 Qmansvednetta · Oct 25, 2020 at 02:09 PM 0
Share

I had the same issue went through all my scripts and found some system collections that I had not put in there e.g. I found

using UnityEngine.Video using UnityEditor using SecurtiyPolicy

in scripts that were not using these resources. I removed them and voilà!. Fixed!

avatar image
0

Answer by RowanG1 · Nov 15, 2017 at 03:20 AM

In my case, although game ran in play mode, it would not build to a physical Android device, with same error message as you. The problem turned out to be a playmode test file. I deleted the file, and the problem was fixed.

Comment
Add comment · 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
0

Answer by mbhagat · Dec 18, 2017 at 08:22 AM

I was using one Editor Extention to clear player pref. I put that script in Editor folder as suggested by @Graham-Dunnett and it solved. Thanks :)

Comment
Add comment · 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
0

Answer by help00686 · Nov 09, 2018 at 07:34 PM

I get this error and have tried everything and still cant sort it after reading everything here

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 arshsingh2004 · Jun 02, 2020 at 03:10 PM 0
Share

same here in 2020 did u find the solution

avatar image Arran2020 · Jul 30, 2020 at 11:58 AM 0
Share

I was having the same problem however easily found a fix.

Go into every Script you have in that unity project and double check the first lines, the ones which say "Using UnityEngine" and "Unity System Collections". I had only added to these lines with a "Using UnityEngine.UI" however when I was going through ALL my scripts for that project I found that there a few extra ones there that weren't there when I started and I had not added (they added themselves there) , for example there was a "Using System Collections X$$anonymous$$P" or something random like that. Simply delete these, save the script and you should be good to go.

I have no idea why they are there and what type of problem they seemed to cause however I can now build my project to android problem free now.

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

28 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Detect if Unity is building/compiling the project/scene 1 Answer

Unity project wont build 0 Answers

Distribute terrain in zones 3 Answers

Using a custom icon for game objects with Gizmos.DrawIcon 1 Answer

Automatic conversion packagename(Android) in Project setting. 0 Answers


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