Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2019.4
2019.4.9f1
2020.1
2020.2
2021.1
Issue ID
1293581
Regression
Yes
MonoScript is registered as both Editor and Runtime script when referring Runtime Assembly in "Editor only" Assembly Definition
How to reproduce:
1. Create a new Unity Project
2. In Project -> Assets -> Create two folders with names of "Editor" and "Runtime"
3. Create a new C# script called "FruitEditor" in the "Editor" folder
4. Create a new C# script called "Fruit" in the "Runtime" folder
5. In the "Runtime" folder create a new Assembly Definition named "Unity.Fruit.Runtime"
6. In the "Editor" folder create a new Assembly Definition named "Unity.Fruit.Editor"
7. Select "Unity.Fruit.Editor" and look at Inspector window
8. Under Platforms, deselect "Any Platform", press "Deselect all", select "Editor"
9. Under Assembly Definition References, press "+", and lock the Inspector window
10. Go to "Runtime" folder and drag "Unity.Fruit.Runtime" to newly create Assembly Definition Reference
11. Press Apply at the bottom of Inspector
12. Copy script inside attached "FruitEditor.txt" to "FruitEditor" script
13. Copy script inside attached "Fruit.txt" to "Fruit" script
14. Reimport "Fruit" and then reimport "FruitEditor"
15. In Assets -> Create "Fruit"
Expected results: "Fruit" is created and no errors occur
Actual results: Error is logged in console "MonoScript is registered as both Editor and Runtime script!"
Reproducible with: 2019.4.0f1, 2019.4.15f1, 2020.1.15f1, 2020.2.0b13, 2021.1.0a7
Not reproducible with: 2018.4.29f1
-
JamesHuey
Sep 05, 2022 19:01
We seem to be able to reproduce this in 2019.4.39f1
-
olivier-janin691
Feb 03, 2021 15:03
Hi guys,
It seems that it's because you're trying to use an .asmdef into an Editor folder. I suggest you to rename your folder. It worked for us.
-
Peter77
Nov 21, 2020 20:44
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a6