Handles.DrawLines lines not showing in scene view

Hi everyone. So here’s the problem, I’m trying to make a selection box in the scene view but the lines are not showing up. Here’s my code:

private void DrawSelectionBox(float originX, float originY, float endX, float endY) {
        Debug.Log(originX + " " + originY + " " + endX + " " + endY);
        Vector3 topLeft = new Vector3(originX, originY, 0f);
        Vector3 botLeft = new Vector3(originX, endY, 0f);
        Vector3 botRight = new Vector3(endX, endY, 0f);
        Vector3 topRight = new Vector3(endX, originY, 0f);

        Vector3[] lines = { topLeft, botLeft, botRight, topRight };
        int[] indexes = { 0, 1, 1, 2, 2, 3, 3, 0 };

        //Handles.DrawLines(lines, indexes);
        //Handles.DrawLine(new Vector3(originX, originY, originY), new Vector3(endX, endY, endY));
        Handles.DrawSolidRectangleWithOutline(lines, new Color(1, 1, 1, 0.2f), new Color(0, 0, 0, 1));
    }

Everything is inside OnSceneGUI and still not showing anything. Please help :confused: Thanks in advance!

You’re using the wrong method :slight_smile:

The code should be called from the OnDrawGizmos function like this:

	private void OnDrawGizmos() {
		DrawSelectionBox(1, 1, 6, 2);
	}

This produces the following:
88808-2017-02-25-17-42-51-unity-550f3-personal-64bit-tem.png