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
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
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 :)