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
9
Question by MSDs · Feb 09, 2013 at 12:21 PM · unityeditorassetbundle

namespace name `UnityEditor' could not be found

hi , I hope find solution to my problem here.

I have this code for build menu of assetBundle options

 using UnityEngine;
 using UnityEditor;
 
 public class ExportAssetBundles : MonoBehaviour {
     [MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
     static void ExportResource () {
         // Bring up save panel
         string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
         if (path.Length != 0) {
             // Build the resource file from the active selection.
             Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
             BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
             Selection.objects = selection;
         }
     }
     [MenuItem("Assets/Build AssetBundle From Selection - No dependency tracking")]
     static void ExportResourceNoTrack () {
         // Bring up save panel
         string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
         if (path.Length != 0) {
             // Build the resource file from the active selection.
             BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path);
         }
     }
 }

the problem happen while build app game it show me this error

 Assets/Scripts/menuAssets.cs(7,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?


and this also

 Error building Player because scripts had compiler errors

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
13
Best Answer

Answer by paulaceccon · Feb 09, 2013 at 05:53 PM

Check this: http://answers.unity3d.com/questions/316805/unityeditor-namespace-not-found.html

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 Zeratul3D · Jul 06, 2018 at 09:20 PM 2
Share

If you came here looking for the error:

 "The type or namespace name 'Animations' does not exist in the namespace 'UnityEditor'"

This is because you are maybe trying to access the AnimatorController component inside your script that is inside UnityEditor.Animations and, as said in the link posted by paulaceccon, the UnityEditor (and all it's sub namespaces) are not compatible/loaded on builds.

To solve this specific issue, replace it with RuntimeAnimatorController.

avatar image
8

Answer by Chonguy-Wang · Aug 14, 2016 at 03:42 PM

when i move the script file into the editor folder, it 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
3

Answer by FlightOfOne · Nov 06, 2018 at 04:30 PM

I got this error when I tried to build with custom attributes and property drawers, which uses UnityEditor.

Using preprocessor fixed it for me, probably the same reason as when moved to editor folder. Is one better than other?

 #if UNITY_EDITOR
 //--code--
 #endif


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
0

Answer by BAbbas · Feb 26, 2017 at 06:28 PM

Delete unwanted resources and especially scripts those are not associated with any GameObject component or not linked with other classes in object form or move ur scripts into "editor" folder, it really solved my problem

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 Mordizer · Nov 11, 2020 at 09:24 PM

I had this issue inside a third party asset and I got around it by adding a reference to the UnityEditor.dll in the project file.

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

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

19 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

Related Questions

Do i need to make asset bundles with upgraded Unity version? 0 Answers

Standalone app for building asset bundles 2 Answers

How to import the object from server to unity 2 Answers

WebGl build error cannot build player while editor is importing assets or compiling scripts 0 Answers

Recursive multiple unity package import and asset bundle build that works in unity 5.6, 2017 and 2018.1.6 does not work in unity 2018.2.X 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