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
- Character spacing value is not applied when using a specific font asset
- [Android][IL2CPP] Player crashes on __memcpy_aarch64_simd+276 when invoking native code via a plugin on some ARM64 Android devices
- [Android]Resources fail to load when the AAB build contains a large Addressables Bundle
- Unity is loading internal version of SharpZipLib instead of local version
- The Context Menu items are ordered incorrectly
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 :)