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
-
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
- URP Player remains in Windows Background processes when the application is closed
- [Android] The built-in URP shaders Lit, Complex Lit and the Simple Lit are not rendered when built on Android devices with an Adreno 300 series GPUs
- "Radio Button" disappears when added under the "RadioButtonGroup" and the parent Visual Element is selected
- ScrollView Scrollbar is jittering when Movement Type "Elastic" is selected and a mouse with a freewheel is used
- [WebGL]"TypeError: Cannot read properties of undefined (reading 'length')" error is thrown when starting the Player when config.autoSyncPersistentDataPath is set to true
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 :)