ShapesDrawer
The ShapesDrawer system provides a fire-and-forget immediate-mode drawing API built on top of the Shapes library. Game code calls static ShapesDrawer.Draw*() methods from any context (Update, Debug, etc.), and the system batches all requests into per-shape queues that are rendered once per camera per frame. Queues are automatically cleared each frame via a custom PlayerLoop injection.
Architecture
Rendering Pipeline
Key Concepts
Fire-and-forget
Call ShapesDrawer.Draw*() from any code. The shape is queued and rendered at the end of the frame. No cleanup required.
Per-frame clearing
A custom PlayerLoopSystem injected at PRE_UPDATE clears all draw queues each frame. Shapes only persist for one frame.
Per-camera rendering
Draw commands are issued inside Draw.Command(cam) for each camera, supporting multi-camera setups.
Render pipeline support
Automatically hooks into either URP/HDRP (beginCameraRendering) or Built-in (Camera.onPreRender).
Shape structs
Each shape type is a readonly struct (e.g., LineDrawer.Line, ArcDrawer.Arc) stored in a List<TShape> queue for cache-friendly iteration.
Quick Start
Drawing Shapes
Using in Debug Systems
Classes
Singleton MonoBehaviour — static draw API, camera hooks, PlayerLoop injection
Abstract generic base for shape-specific drawers with queue and draw pattern
Shape struct + drawer implementations (Line, Arc, Cube, etc.)
See Also
Shapes Library — the underlying rendering library
Last updated