private static bool CollideRectCirc(RectangleCollider a, CircleCollider b) { if (a.IntersectsPoint(b.GetCenter())) return true; //Check the circle against the four edges of the rectangle Vector2 pA = a.GetTopLeft(); Vector2 pB = a.GetTopRight(); Vector2 pC = a.GetBottomRight(); Vector2 pD = a.GetBottomLeft(); if (b.IntersectsLine(pA, pB, 0) || b.IntersectsLine(pB, pC, 0) || b.IntersectsLine(pC, pD, 0) || b.IntersectsLine(pD, pA, 0)) return true; return false; }