A fix for OverlapCircleNonAlloc Deprecated

Someone else had this error too, but their exact fix did not work for me. I am using 2023.2.2f1, and it’s almost definitely because of this. Here is what appears to work for me:

coinBuffer[0] = Physics2D.OverlapCircle(spawnPoint, coinRadius,layerMask);
if(coinBuffer[0] == null){
return spawnPoint;

When referring back to the docs it didn’t look like there was an easy solution, but eventually I found this in the intellisense overloads:

Collider2D Physics2D.OverlapCircle(Vector2 point, float radius, int layerMask)

Hope that helps someone.

1 Like

Privacy & Terms