In-game command builder not working

The green rectangle only show at the Scene window, nothing shows in the Game window

            if (isRightMouseDragging && Input.GetMouseButtonUp(1))
            {
                isRightMouseDragging = false;
            }

            if (Input.GetMouseButtonDown(1))
            {
                isRightMouseDragging = true;
                selectionVertices[0] = mousePosition;
            }

            if (isRightMouseDragging && Input.GetMouseButton(1))
            {
                selectionVertices[1] = new Vector3(mousePosition.x, selectionVertices[0].y, 0);
                selectionVertices[2] = mousePosition;
                selectionVertices[3] = new Vector3(selectionVertices[0].x, mousePosition.y, 0);

                var draw = Draw.ingame;
                using (draw.WithLineWidth(borderWidth))
                {
                    draw.Polyline(selectionVertices, true, Color.green);
                }
            }

Hi

Are you sure the game camera has z=0 in its frustrum?

Hi
After add draw.InScreenSpace(mainCamera) below draw.WithLineWidth(borderWidth).now the green rectangle will show at the Game window correctly.

1 Like