box collider 2d collision

Is there any way to determine from which side (up-down-left-right) the collision happened? currently I calculate the angle between both game objects’ positions and the (0, 0) point and using it, I determine the collision side, but I would like to know if there is a better way for doing this or not

What you are really looking for is the Physics2D.BoxCast which have the direction parameter.