Search Issue Tracker

Won't Fix

Votes

0

Found in

2019.4

2020.3

2021.1

2021.2

2021.2.0b4

2022.1

Issue ID

1352133

Regression

No

Cannot resolve/suppress warnings when using deprecated/stripped properties with "new" keyword

Scripting

-

How to reproduce:
1. Open the attached project
2. Inspect the "ImpossibleWarnings.cs" script
3. Note that a warning is thrown for a deprecated property
4. Try suppressing the warning by writing a "new" keyword as suggested
5. Try making a build
6. Inspect the Console Window

Expected result: No warnings are thrown. There's a way to suppress warnings on deprecated properties
Actual result: In Editor there's a property "hides inherited member. Use the new keyword if hiding was intended." warning is thrown, when applying the suggested "new" keyword there's a "The member does not hide an accessible member. The new keyword is not required." warning thrown

Reproducible with: 2019.4.29f1, 2020.3.15f1, 2021.1.16f1, 2021.2.0b5, 2022.1.0a4

Workaround:
- Use another name for the field
- Use #pragma warning disable 108,114

  1. Resolution Note (2022.1.X):

    Unfortunately, adding those deprecated symbols to the player-flavor modules would lead to possible breaking changes in other projects, so we won't fix it.

    As a workaround, you can use #if UNITY_EDITOR blocks to differentiate field declarations between editor and player builds, or avoid naming conflicts all together by picking another name for your fields.

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.