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)

  1. 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 :)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.