void drawLine(Vector2 begin, Vector2 end) { var point1 = cam.ViewportToScreenPoint(new Vector2 { x = begin.x, y = 1 - begin.y }); var point2 = cam.ViewportToScreenPoint(new Vector2 { x = end.x, y = 1 - end.y }); GUILine.draw(point1, point2, Color.red); }
void drawDiagonal() { var point1 = cam.ViewportToScreenPoint(Vector2.zero); var point2 = cam.ViewportToScreenPoint(new Vector2 { x = 1 }); var point3 = cam.ViewportToScreenPoint(new Vector2 { y = 1 }); var point4 = cam.ViewportToScreenPoint(Vector2.one); GUILine.draw(point1, point4, Color.red); GUILine.draw(point2, point3, Color.red); }
void draw(Rect rect) { var point1 = cam.ViewportToScreenPoint(new Vector2 { x = rect.xMin, y = 1 - rect.yMin }); var point2 = cam.ViewportToScreenPoint(new Vector2 { x = rect.xMin, y = 1 - rect.yMax }); var point3 = cam.ViewportToScreenPoint(new Vector2 { x = rect.xMax, y = 1 - rect.yMax }); var point4 = cam.ViewportToScreenPoint(new Vector2 { x = rect.xMax, y = 1 - rect.yMin }); GUILine.draw(point1, point2); GUILine.draw(point2, point3); GUILine.draw(point3, point4); GUILine.draw(point4, point1); GUILine.draw(point4, point1); }