,How to use Physics2D.OverlapArea

Couldn’t find an answer. How do I use them?
following script:


walled = Physics2D.OverlapArea(wallCheck.position, checkArea, whatIsWall);


  • wallCheck is a Transform variable →
    Vector A
  • checkArea is a Vector2 variable →
    Vector B
  • whatIsWall is a LayerMask.

issue with this. This returns always true, no matter if it overlaps with the according layer or not. I put the object out into nirvana and it still returns always true.
OverlapCircle works charmingly fine but not what I want.

Or is something wrong with my Gizmo? But I moved my Object ten million miles away from any object or Layers. It was impossible to overlap with anything…


Gizmos.DrawWireCube(wallCheck.position, checkArea);

DrawWireCube and OverlapArea dont take same arguments, so maybe thats your issue, ill share an example:

VectorA (0,0,0) VectorB (10,10,10)
if you use overlapArea it will “create the box” with the center in point (5,5,5) since the 2 vectors are the corners, and if you use DraWireCube it will create a gizmo box with center in point (0,0,0) and size of 10 units (this case the same but in other the size of the box will be different too)