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
- Texture displays visual artifacts and has a broken aspect ratio when it is imported in RGB 48-bit format
- Diagnostic Warning Resets When Navigating Away and Returning to Diagnostics Settings
- Checkbox Collides with Text in Shader Graph Preferences Settings
- Crash on mecanim::animation::TransformValuesFromClip when entering the Play Mode in a project with Animancer Pro v8
- Connection to Named Pipes fails when server and client are run
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.