- Home /
Scripts in Plugins/Folder/Editor are included in build?
I have a property drawer at Assets/Plugins/Loius/Editor/DisplayIfDrawer.cs
When I try to build, "the type or namespace UnityEditor could not be found" for this file (and other files in similar locations that require UnityEditor).
I thought that Editor folders (or at least scripts inside them) were omitted from the build? Why do I have to add #if UNITY_EDITOR to these files but not to things in Assets/Editor?
Is this a bug I should report or is there some interaction I'm unaware of?
Note that Assets/Plugins is a "special folder" used by Unity for native plugins (not .NET assemblies, but native code). Do you need to put your script into this folder, or could it be in some other top-level Assets folder?
I think Assets/Editor
and Assets/Plugins/Editor
might be the only two "magic" folders, when it comes to the UnityEditor namespace.
Answer by TheBeardPhantom · Sep 12, 2014 at 08:27 PM
http://docs.unity3d.com/Manual/SpecialFolders.html
http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
You cannot place certain special folders inside other special folders and have them work as intended. Placing and "Editor" folder inside the "Plugins" folder will not work as intended.
Use the Special Folders only for their intended use to avoid this:
Plugins
Unity lets you add Plugins to a project to extend the features available to Unity. Plugins are native DLLs that are typically written in C/C++. They can access third party code libraries, system calls and other things that are not provided by Unity out of the box. Plugins must be placed in a folder called Plugins to be detected by Unity and like the Editor folder, this affects the order in which scripts are compiled. See the page on Special Folders and Script Compilation Order for further details.
Are you sure you can't put native plugins for editor use into Plugins\Editor? (I thought you could but I haven't tested.)