public static void DrawRect2D(RectTransform rt, Color color) { var drawCorners = new Vector3[5]; rt.GetWorldCorners(drawCorners); drawCorners[4] = drawCorners[0]; GizmoHelper.DrawLines(drawCorners, color); }
public static void DrawRect2D(Rect RectInWorld, Color color) { var drawCorners = new Vector3[5]; var bottomLeft = new Vector3(RectInWorld.position.x, RectInWorld.position.y, 0f); drawCorners[0] = bottomLeft; drawCorners[1] = bottomLeft + new Vector3(0f, RectInWorld.height, 0f); drawCorners[2] = bottomLeft + new Vector3(RectInWorld.width, RectInWorld.height, 0f); drawCorners[3] = bottomLeft + new Vector3(RectInWorld.width, 0f, 0f); drawCorners[4] = bottomLeft; GizmoHelper.DrawLines(drawCorners, color); }