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
- The tag adder functionality does not work if a space is entered instead of a name
- Errors thrown in the Console when configuring In-App Purchases package
- Longer Scaler Profile names go out of the"Scaler Profilers" section
- AI Navigation window UI elements overlap when the AI Navigation window is docked and resized
- Editor freezes after some time when using NavMeshQuery::Raycast
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.