resharper-unity icon indicating copy to clipboard operation
resharper-unity copied to clipboard

Deprecated: PreferNonAllocApiAnalyzer

Open JosiahBradley opened this issue 1 year ago • 4 comments

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]

JosiahBradley avatar May 15 '24 04:05 JosiahBradley

Thanks. Please see RIDER-112462

citizenmatt avatar May 16 '24 21:05 citizenmatt

@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.

JosiahBradley avatar May 18 '24 05:05 JosiahBradley

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

citizenmatt avatar May 22 '24 15:05 citizenmatt

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

JosiahBradley avatar May 22 '24 15:05 JosiahBradley