Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2018.4.24f1
2020.2
Issue ID
1265245
Regression
No
Project build fails when using a folder named "Editor" in a folder that has an Assembly Definition
How to reproduce:
1. Open user's attached project
2. Open Scene "SampleScene"
3. Go to File > Build Settings.. and click Add Open Scenes
4. Build the project
Expected result: project builds without errors
Actual result: errors such as "error CS0246: The type or namespace name 'PropertyDrawer' could not be found (are you missing a using directive or an assembly reference?)" appear
Reproducible with: 2018.4.26f1, 2019.4.6f1, 2020.1.0f1, 2020.2.0a19
Notes:
-You can make it build successfully by moving the "Editor" folder out of the "Framework" (this folder has an Assembly Definition) folder
Comments (1)
-
akuno
Dec 27, 2023 00:12
Bad design. Unity should always remove anything from any Editor folder from compilation.
A cleaner solution is to just use #if UNITY_EDITOR on any code file within those folders.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
- "Assertion failed on expression" error occurs when multiple Animation Components are instantiated after changing the Culling Type
- MacOS persistentDataPath uses old path when built compared to Editor Play mode
- Crash on RaiseException when entering Play Mode in a specific project
- Debug Console does not reappear when disabling and re-enabling Debug.developerConsoleEnabled
Resolution Note:
https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html
"Unity normally compiles any scripts in folders named Editor into the predefined Assembly-CSharp-Editor assembly no matter where those scripts are located. However, if you create an Assembly Definition Asset in a folder that has an Editor folder underneath it, Unity no longer puts those Editor scripts into the predefined Editor assembly. Instead, they go into the new assembly created by your Assembly Definition — where they might not belong. To manage Editor folders, you can do the following:
1. Add an Assembly Definition Asset to each affected Editor folder and set the Platform property of that assembly so it is only used for the Editor Platform.
2. Move all editor specific code to a central location not covered by an Assembly Definition."
In this case you would want to go with solution #1 from what I understand what you're trying to do :)