Search Issue Tracker
By Design
Votes
0
Found in
2019.3.0a7
Issue ID
1164124
Regression
No
Can't assign missing script to a prefab if an asmdef is present in the folder
1. What happened
Trying to fix missing script component within a prefab in isolation mode will complain about scripts that are not derived from monobehavior.
2. How we can reproduce it using the example you attached
1. Load the attached project or add the assets to an existing one
2. Select the Cube.prefab asset in the project and open the prefab (Isolation mode)
3. Try to assign script A and B to the missing script component on the prefab
Note that the warning doesn't go away when assigning a script to the slot
4. Try to leave Isolation mode and click on the Save button when prompted
Result: A "Save Failed" dialog will pop up and after clicking the okay button, error will be printed in the console about the scripts we assigned don't derive from MonoBehaviour
Deleting the AsmDef.asmdef asset from the project will make the warning go away and we'll be able to save the changes to the prefab
This is reproducible in all Unity versions since the implementation of Nested Prefab and its Isolation mode. Before, we were simply not able to instanciate a prefab in the scene that has missing scripts in it.
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
- Some UXML Template Asset foldouts appear enabled when all fields inside are disabled
- URP Terrain Demo crash on burst_signal_handler after Generating lighting
- Project window button icons are poorly visible and their shades differ in Light theme
- GC.Alloc called by HDRenderPipeline.LensFlareMergeOcclusionDataDrivenPass() when playing the default HDRP Sample Template project
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
Resolution Note (2020.1.X):
By design. The scripts in this project are editor only scripts because the asmdef is only compatible with the ditor.
If you try to attach the scripts to a regular game object by dragging into one in the Hierarchy, you will get dialog saying "Can't add script. The script is an editor script".