Search Issue Tracker
Won't Fix
Votes
0
Found in
2020.3.35f1
2021.3.3f1
2022.1.2f1
Issue ID
UUM-759
Regression
Yes
MonoBehaviours are not recognized when using a preprocessor directive in an attribute field with a comma
How to reproduce:
1. Open the attached project ("monobehaviourPreprocessorBug.zip")
2. Click on the "ScriptWithAttributeCommaInNamespace" script (Assets -> Scripts -> ATestNamespace)
Expected result: The script is recognized as a MonoBehaviour
Actual result: "No MonoBehavior scripts in the file, or their names do not match the file name." warning is shown in the Inspector
Reproducible with: 2020.1.0a15, 2020.3.35f1, 2021.3.3f1, 2022.1.2f1, 2022.2.0a2
Not reproducible with: 2019.4.39f1, 2020.1.0a14, 2022.2.0a3, 2022.2.0a15
Reproducible on: macOS 12.1 (Intel)
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 should be fixed in the latest version of Unity, the comma is not the issue, is the #if statement.
The workaround is to just have the #if statements and then the attributes inside those #if statements :)