Does Draw.ingame.WireRectangle work in game page?

Aline 1.6.4
the Draw.ingame.WireRectangle only draw rectangle on Scene, but draw nothing on Game

private void LateUpdate()
{
            // Vector2 v1 = ...
            // Vector2 v3 = ...
            Rect rect = new Rect(v1.x, v1.y, v3.x - v1.x, v3.y - v1.y);
            Draw.ingame.WireRectangle(rect, Color.cyan);
}

What I’m doing is draw the camera view range in the minimap, and in the LateUpate() I calculate the rectangle then draw it with Draw.ingame.WireRectangle. it draw the rectangle correctly in the Scene but nothing changed in the Game.

Hi

It sounds like you want to draw in camera-space. In that case you might want to wrap your code in InScreenSpace - ALINE

Hi

  1. It will show the rectangle in the game now, but it is covered by UI image, how can I show the rectangle on the top of the UI?
  2. Below the code will execute every frame in LateUpdate to draw the rectangle which involves two using() code blocks, can I initialize the inGameCommandBuilder.InScreenSpace and inGameCommandBuilder.WithLineWidth at Start() so that I only call inGameCommandBuilder.WireRectangle at LateUpdate()?
var inGameCommandBuilder = Draw.ingame;
using (inGameCommandBuilder.InScreenSpace(mainCamera))
            {
                using (inGameCommandBuilder.WithLineWidth(2))
                {
                    Rect rect = new Rect(minX, minY, sizeX, sizeY);
                    inGameCommandBuilder.WireRectangle(rect, Color.cyan);
                }
            }
  1. Currently there’s no way to draw on top of the UI, I’m afraid.
  2. No, these need to run every frame as they build up the context for the WireRectangle call.