void OnGUI() { if (isSelecting && canSelect) { // Create a rect from both mouse positions var rect = UnitSelectUtils.GetScreenRect(mousePosition1, Input.mousePosition); UnitSelectUtils.DrawScreenRect(rect, new Color(0.8f, 0.8f, 0.95f, 0.25f)); UnitSelectUtils.DrawScreenRectBorder(rect, 2, new Color(0.8f, 0.8f, 0.95f)); } }
public static void DrawScreenRectBorder(Rect rect, float thickness, Color color) { // Top UnitSelectUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color); // Left UnitSelectUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color); // Right UnitSelectUtils.DrawScreenRect(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color); // Bottom UnitSelectUtils.DrawScreenRect(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color); }