- Home /
Why do Physics2D NonAlloc functions get deprecated?
Hello Community,
at the moment, I am refactoring a 2D project. When I wanted to change the function Physics2D.OverlapCircleAll
to Physics2D.OverlapCircleAllNonAlloc
I noticed, that all static 2D NonAlloc functions are marked as deprecated in the documentation, and it is recommanded, to use the "standard" methode instead:
https://docs.unity3d.com/ScriptReference/Physics2D.html
I researched why this will happen, and also tested, if the Non-NonAlloc functions maybe got an upgrade, but they are still producing garbage. Do you have an idea, what could the plan of removing this handy functions be?
Answer by Casiell · Jan 05 at 01:09 PM
From what I see in the documentation, the regular OverlapCircle method has an overload that takes an array where the results will be placed. So my guess is that they want to remove OverlapCircleAll and OverlapCircleAllNonAlloc and use a single method with overloads instead.
But also from my experience, Unity rarely if ever actually removes obsolete methods. There are methods and properties that are marked as obsolete since Unity 5, that are still in 2021 versions...
You are absolute right my friend! I overlooked, that Unity recommends to use OverlapCircle instead of OverlapCircleNonAlloc in the Documentation info text, because I thought it was meant OverlapCircleAll. So I only looked into the overloads of the CircleAll-Methode. Yeah, and I also recognized that obsolete functions are often dont get removed, but I wanted to stay safe, because its a hobby project which will surely follow me for a long time. So, thanks for pointing me in the right direction!
Your answer
