Search Issue Tracker
By Design
Votes
1
Found in
2022.2.0b11
2023.1.0a14
Issue ID
UUM-16718
Regression
Yes
Partial MonoBehaviour script can not be attached to a GameObject when another one exists with the same file and class name
How to reproduce:
1. Open the attached project (Part.zip)
2. In the Project panel navigate to the "Scripts" folder
3. Drag the "Part" script onto any GameObject in the Hierarchy
Expected result: The script is added to the GameObject
Actual result: The editor opens a "Can't add script" window informing that the script could not be attached
Reproducible with: 2022.2.0a5, 2022.2.0b11, 2023.1.0a14
Not reproducible with: 2020.3.40f1, 2021.3.12f1, 2022.1.19f1, 2022.2.0a4
Reproducible on: Windows 10, Ubuntu 20.04
Note: The script being attached has to have a partial class and another script with the same file and class name in another folder
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
This is by design.
The workarround is having the partial classes having different filenames. While the partial class you want to use have the same filename as the class name. So only the class that matches the filename is useable.