JetBrains / resharper-unity

Unity support for both ReSharper and Rider
Apache License 2.0
1.21k stars 134 forks source link

Deprecated: PreferNonAllocApiAnalyzer #2445

Open JosiahBradley opened 4 months ago

JosiahBradley commented 4 months ago

Referring to the analysis code in resharper/resharper-unity/src/Unity/CSharp/Daemon/Stages/Analysis/PreferNonAllocApiAnalyzer.cs Unity no longer recommends this but the opposite. Following this inspection will lead to broken code in the future as Unity deprecates these functions. This also caused some unneeded refactors.

Notice of deprecation from Unity: [Physics2D].[OverlapAreaNonAlloc]

Get a list of all Colliders that fall within a specified area. Note: This method will be deprecated in a future build and it is recommended to use OverlapArea instead.

Recommended action in Project Settings or script: [Reuse Collision Callbacks]

citizenmatt commented 4 months ago

Thanks. Please see RIDER-112462

JosiahBradley commented 4 months ago

@citizenmatt I was the one who triggered that issue being opened via thread necro of https://rider-support.jetbrains.com/hc/en-us/community/posts/11634372238098-NonAlloc-in-Unity-is-either-deprecated-or-ineffective?page=1#community_comment_18933790136466 I'm linking everything together for the next person using a search engine that brought me to the original thread after my own refactor woes.

citizenmatt commented 4 months ago

Thanks! We'll hopefully get on to this as part of the next release. We'd like to suggest useful transformations, not deprecated ones!

JosiahBradley commented 4 months ago

Awesome! The inspection code has definitely helped more than not. Glad to assist with the update process.