Editor script in /Editor, yet throws build err?

Eg:

Library\PackageCache\com.some.embedded.test.pkg@123*\Editor*\SomeEditorScript.cs(9,41): error CS0246: The type or namespace name 'EditorWindow' could not be found (are you missing a using directive or an assembly reference?)

This is in an /Editor dir for editor tooling, so why would this dir even be considered for builds?

Probably because it's under a non-editor assembly definition, which overrides the special 'Editor' folder rule (and all other special folders, in fact).

2 Likes


Did you properly restrict your assembly to be Editor-only? Packages require asmdef for code, and folder name doesn't matter for asmdefs, it's the assembly definition that does the work.
https://docs.unity3d.com/Manual/cus-asmdef.html
https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html#create-editor-assembly

2 Likes


Ah this was it -- good to know that these override special perms. Thanks @Spy-Master + @spiney199

I‘m pretty sure a Resources folder continues to function as expected, asmdef or not. That may simply be because Resources do not contain scripts, so I tend to think asmdef only affect special folders that are special for scripts but not any non-script special folder. True or false? I‘m leaning towards true but not 100% certain.


Well Resources has nothing to do with script compilation.