Class DebugDraw
Lightweight mesh-based debug drawing utility for Scylla Core. Provides static methods for immediate-mode drawing of 2D and 3D shapes in both world-space and screen-space coordinates.
Uses Graphics.DrawMesh with a simple unlit vertex-color shader.
No dependency on the Graphics module. Auto-initializes on play mode entry.
Inherited Members
Namespace: Scylla.Core.Util.DebugDraw
Assembly: ScyllaCore.dll
Syntax
public static class DebugDraw
Remarks
Architecture
Each call to a shape method enqueues a DebugDrawCommand into an internal
command list managed by Scylla.Core.Util.DebugDraw.DebugDrawManager. At the end of every frame,
Scylla.Core.Util.DebugDraw.DebugDrawManager builds all queued commands into batched meshes and
submits them via Graphics.DrawMesh. This work is driven by
DebugDrawRunner.LateUpdate, a persistent hidden MonoBehaviour created
automatically at runtime. In the Unity Editor, world-space shapes are additionally
rendered into open Scene View panels via SceneView.duringSceneGui.
Auto-initialization
The system initializes itself automatically after scene load via
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)].
No manual setup, bootstrap dependency, or prefab is required. Simply call any
DebugDraw method and the system will be ready.
Thread safety
All DebugDraw methods must be called from the main Unity thread.
The internal command lists are not thread-safe.
Performance
Commands with duration == 0 are immediate: they are drawn for one frame and
then discarded. Commands with duration > 0 are persistent: they survive
across frames until their expiry time is reached. All commands for a given coordinate
space are batched into a single mesh per frame, minimising draw calls. The system
caps the command count at 4096 per list; excess commands are silently dropped
with a one-time console warning. Polyline point data is bounded by a shared
65535-point limit across all buffers.
// Draw a green circle at the origin
DebugDraw.Circle(Vector3.zero, 1f);
// Draw a red filled rectangle for 2 seconds
DebugDraw.Rectangle(transform.position, new Vector2(2, 1), filled: true, color: Color.red, duration: 2f);
// Draw a screen-space crosshair
DebugDraw.Cross(new Vector3(Screen.width / 2, Screen.height / 2, 0), 20f, color: Color.white, space: DebugDrawSpace.Screen);
Properties
DefaultColor
Gets or sets the default color used when no explicit color is passed to a draw method.
Declaration
public static Color DefaultColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color | A UnityEngine.Color value applied to any shape method that receives |
Remarks
This value is reset to its default on every domain reload (including when Unity's Disable Domain Reload option is active in Play Mode preferences), so it should not be treated as persistent game state.
DefaultSegments
Gets or sets the default tessellation segment count used when no explicit segment count is passed to a draw method.
Declaration
public static int DefaultSegments { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The number of straight-line segments used to approximate curves (circles, ellipses)
when a method receives |
Remarks
This value is reset to its default on every domain reload (including when Unity's Disable Domain Reload option is active in Play Mode preferences), so it should not be treated as persistent game state.
DefaultThickness
Gets or sets the default line and outline thickness used when no explicit thickness is passed to a draw method.
Declaration
public static float DefaultThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| float | Thickness in world units applied when a method receives |
Remarks
This value is reset to its default on every domain reload (including when Unity's Disable Domain Reload option is active in Play Mode preferences), so it should not be treated as persistent game state.
MaxCommands
Gets or sets the maximum number of draw commands that may be queued per frame. When this limit is reached, additional commands are silently dropped.
Declaration
public static int MaxCommands { get; set; }
Property Value
| Type | Description |
|---|---|
| int | An integer capped at a minimum of 256. Defaults to |
Methods
Arc(Vector3, float, float, float, Color?, float, int, Vector3?, float, DebugDrawSpace)
Draws a circular arc as an open polyline, spanning a sweep angle from a start angle.
Declaration
public static void Arc(Vector3 center, float radius, float startAngle, float sweepAngle, Color? color = null, float thickness = -1, int segments = -1, Vector3? normal = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the arc's circle in world-space or screen-space, depending on
|
| float | radius | The arc radius. Non-positive values draw nothing. |
| float | startAngle | The angle in degrees at which the arc begins, measured counterclockwise from the shape's local +X axis. |
| float | sweepAngle | The angular extent of the arc in degrees. Positive values sweep counterclockwise,
negative values clockwise. Clamped to the range |
| Color? | color | The color of the arc. Pass |
| float | thickness | The line thickness. Pass |
| int | segments | The number of straight-line segments a full circle would use; the arc uses a
proportional share of them (minimum 2). Pass |
| Vector3? | normal | The surface normal of the plane in which the arc lies, interpreted exactly as in
Circle(Vector3, float, bool, Color?, float, int, Vector3?, float, DebugDrawSpace). Pass |
| float | duration | How long in seconds the arc should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Arrow(Vector3, Vector3, Color?, float, float, float, DebugDrawSpace)
Draws a directional arrow from a start point to an end point, with a filled triangular arrowhead at the tip.
Declaration
public static void Arrow(Vector3 start, Vector3 end, Color? color = null, float thickness = -1, float headSize = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | The tail of the arrow (where the shaft begins). |
| Vector3 | end | The tip of the arrow (where the arrowhead points). |
| Color? | color | The color of the entire arrow (shaft and head). Pass |
| float | thickness | The visual thickness of the shaft line. Pass |
| float | headSize | The arrowhead length expressed as a fraction of the total arrow length. For example,
|
| float | duration | How long in seconds the arrow should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
The arrowhead is a filled triangle rendered with double-sided geometry (both winding orders are emitted), so it is visible from both sides regardless of camera orientation.
The perpendicular axis for the arrowhead base is computed differently per space:
in Screen it is a 2D 90-degree rotation of the
direction vector in the XY plane; in World it uses
a cross product with Vector3.up, falling back to Vector3.right
when the direction is nearly parallel to Vector3.up.
If start and end are closer than
0.0001 units apart, the method returns without drawing.
Axes(Vector3, Quaternion?, float, float, float)
Draws three color-coded axis lines at a position to visualize an orientation in world space. The X axis is drawn in red, the Y axis in green, and the Z axis in blue.
Declaration
public static void Axes(Vector3 position, Quaternion? rotation = null, float size = -1, float thickness = -1, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The origin of the axis gizmo in world space. |
| Quaternion? | rotation | The orientation of the axes. Pass |
| float | size | The length of each axis line. Pass |
| float | thickness | The visual thickness of each axis line. Pass |
| float | duration | How long in seconds the axes should remain visible. Pass |
Remarks
This method always operates in World and does not
accept a space parameter. Each axis ignores DefaultColor
and uses a fixed channel color (red/green/blue) to match the Unity editor convention.
To draw a single-color cross marker, use Cross(Vector3, float, Color?, float, float, DebugDrawSpace) instead.
See Also
Circle(Vector3, float, bool, Color?, float, int, Vector3?, float, DebugDrawSpace)
Draws a circle centered at a position, lying in the plane defined by the normal direction, either filled or as an outline.
Declaration
public static void Circle(Vector3 center, float radius, bool filled = false, Color? color = null, float thickness = -1, int segments = -1, Vector3? normal = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the circle in world-space or screen-space, depending on
|
| float | radius | The radius of the circle. |
| bool | filled | When |
| Color? | color | The color of the circle. Pass |
| float | thickness | The outline thickness. Only used when |
| int | segments | The number of straight-line segments used to tessellate the circle perimeter. Higher
values produce a smoother circle at the cost of more vertices. Pass |
| Vector3? | normal | The surface normal of the plane in which the circle lies. Controls the circle's
orientation in 3D space. Pass |
| float | duration | How long in seconds the circle should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
The normal parameter controls which plane the circle is drawn
in. For example, Vector3.up places the circle flat on the XZ ground plane,
Vector3.forward places it facing the Z axis in the XY plane, and
Vector3.right places it in the YZ plane. Internally the normal is converted
to a rotation via ResolveNormalRotation(Vector3?, DebugDrawSpace).
See Also
Clear()
Clears all persistent draw commands (commands with duration > 0) before
their expiry time, along with their associated polyline point data.
Declaration
public static void Clear()
Remarks
Immediate commands (those with duration == 0) are automatically discarded at
the end of each frame and are unaffected by this call. Call Clear()
when scene state changes invalidate previously queued persistent shapes - for example
when switching debug visualization modes or reloading a level.
Cross(Vector3, float, Color?, float, float, DebugDrawSpace)
Draws a cross marker centered at a position. In world space the cross consists of three lines along the X, Y, and Z axes. In screen space it consists of two lines along the X and Y axes only.
Declaration
public static void Cross(Vector3 center, float size = -1, Color? color = null, float thickness = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the cross in world-space or screen-space, depending on
|
| float | size | The total length of each arm (each line spans from |
| Color? | color | The color of the cross lines. Pass |
| float | thickness | The visual thickness of each line. Pass |
| float | duration | How long in seconds the cross should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
In World, three lines are drawn: along the X axis, along the Y axis, and along the Z axis. In Screen, only the X and Y axis lines are drawn, since there is no meaningful Z dimension in screen space. To draw color-coded world-space axes, use Axes(Vector3, Quaternion?, float, float, float) instead.
See Also
Ellipse(Vector3, float, float, bool, Color?, float, int, Quaternion?, float, DebugDrawSpace)
Draws an ellipse with independent horizontal and vertical radii, either filled or as an outline.
Declaration
public static void Ellipse(Vector3 center, float radiusX, float radiusY, bool filled = false, Color? color = null, float thickness = -1, int segments = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the ellipse in world-space or screen-space, depending on
|
| float | radiusX | The radius along the ellipse's local X axis (half-width before rotation). |
| float | radiusY | The radius along the ellipse's local Y axis (half-height before rotation). |
| bool | filled | When |
| Color? | color | The color of the ellipse. Pass |
| float | thickness | The outline thickness. Only used when |
| int | segments | The number of straight-line segments used to tessellate the ellipse perimeter.
Pass |
| Quaternion? | rotation | The rotation applied to the ellipse around its |
| float | duration | How long in seconds the ellipse should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Grid(Vector3, Vector2, int, int, Color?, float, Quaternion?, float)
Draws a grid of evenly-spaced lines in world space on the XZ plane by default.
Declaration
public static void Grid(Vector3 center, Vector2 size, int cellsX, int cellsY, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the grid in world space. |
| Vector2 | size | The total width ( |
| int | cellsX | The number of cells along the grid's local X axis. Must be at least |
| int | cellsY | The number of cells along the grid's local Y axis (which maps to world Z when
using the default identity rotation). Must be at least |
| Color? | color | The color of the grid lines. Pass |
| float | thickness | The visual thickness of each grid line. Pass |
| Quaternion? | rotation | The rotation applied to the entire grid around its |
| float | duration | How long in seconds the grid should remain visible. Pass |
Remarks
With the default identity rotation, the grid lies in the XZ plane: vertical
lines run parallel to the local Z axis and horizontal lines run parallel to the
local X axis. The second dimension of size and
cellsY correspond to world Z depth, not world Y height.
This method always operates in World and does not
accept a space parameter. Each line is submitted as a separate
Line(Vector3, Vector3, Color?, float, float, DebugDrawSpace) command so large grids add many commands - keep cell counts
reasonable to avoid hitting the 4096-command cap.
Hexagon(Vector3, float, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a regular hexagon (6-sided polygon) centered at a position.
Convenience wrapper around RegularPolygon(Vector3, float, int, bool, Color?, float, Quaternion?, float, DebugDrawSpace) with sides = 6.
Declaration
public static void Hexagon(Vector3 center, float radius, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the hexagon in world-space or screen-space, depending on
|
| float | radius | The circumscribed radius - the distance from the center to each vertex. |
| bool | filled | When |
| Color? | color | The color of the hexagon. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the hexagon around its |
| float | duration | How long in seconds the hexagon should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Label(Vector3, string, float, Color?, float, float, DebugDrawSpace, DebugDrawTextAlign)
Draws a short text label using a built-in 16-segment vector font rendered as line commands. Intended for debug annotations such as state names and numeric readouts; not a general-purpose text renderer.
Declaration
public static void Label(Vector3 position, string text, float size = -1, Color? color = null, float thickness = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World, DebugDrawTextAlign align = DebugDrawTextAlign.Center)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The anchor of the label in world-space or screen-space, depending on
|
| string | text | The text to draw. Lowercase letters are folded to uppercase. Characters without
a glyph in the built-in font render as blank space. |
| float | size | The character height. Pass |
| Color? | color | The color of the text lines. Pass |
| float | thickness | The visual thickness of the segment lines. Pass |
| float | duration | How long in seconds the label should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
| DebugDrawTextAlign | align | How the text is placed horizontally relative to |
Remarks
In world space the glyph plane is billboarded toward the main camera (falling back to the current render camera, then to the world XY plane when no camera exists). The camera lookup is cached once per frame. Each lit segment is one Line(Vector3, Vector3, Color?, float, float, DebugDrawSpace) command, so a typical 10-character label costs on the order of 50 to 100 line commands; keep persistent label counts modest.
See Also
Line(Vector3, Vector3, Color?, float, float, DebugDrawSpace)
Draws a line segment between two points in the specified coordinate space.
Declaration
public static void Line(Vector3 start, Vector3 end, Color? color = null, float thickness = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | start | The world-space or screen-space start point of the line, depending on
|
| Vector3 | end | The world-space or screen-space end point of the line, depending on
|
| Color? | color | The color of the line. Pass |
| float | thickness | The visual thickness of the line. The line is rendered as a camera-facing quad
whose width equals this value. Pass |
| float | duration | How long in seconds the line should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
The line is rendered as a camera-facing quad whose width equals
thickness. This means the line always faces the active camera
and has consistent pixel width regardless of distance in world space.
Octagon(Vector3, float, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a regular octagon (8-sided polygon) centered at a position.
Convenience wrapper around RegularPolygon(Vector3, float, int, bool, Color?, float, Quaternion?, float, DebugDrawSpace) with sides = 8.
Declaration
public static void Octagon(Vector3 center, float radius, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the octagon in world-space or screen-space, depending on
|
| float | radius | The circumscribed radius - the distance from the center to each vertex. |
| bool | filled | When |
| Color? | color | The color of the octagon. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the octagon around its |
| float | duration | How long in seconds the octagon should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Pentagon(Vector3, float, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a regular pentagon (5-sided polygon) centered at a position.
Convenience wrapper around RegularPolygon(Vector3, float, int, bool, Color?, float, Quaternion?, float, DebugDrawSpace) with sides = 5.
Declaration
public static void Pentagon(Vector3 center, float radius, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the pentagon in world-space or screen-space, depending on
|
| float | radius | The circumscribed radius - the distance from the center to each vertex. |
| bool | filled | When |
| Color? | color | The color of the pentagon. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the pentagon around its |
| float | duration | How long in seconds the pentagon should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Polyline(IReadOnlyList<Vector3>, bool, Color?, float, float, DebugDrawSpace)
Draws a polyline connecting a sequence of points in order.
Declaration
public static void Polyline(IReadOnlyList<Vector3> points, bool closed = false, Color? color = null, float thickness = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<Vector3> | points | An ordered list of world-space or screen-space points defining the path. Must
contain at least two points; if |
| bool | closed | When |
| Color? | color | The color of the line segments. Pass |
| float | thickness | The visual thickness of each segment. Pass |
| float | duration | How long in seconds the polyline should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
The point data is copied into an internal shared buffer managed by
Scylla.Core.Util.DebugDraw.DebugDrawManager. If adding the points would exceed the system's
maximum of 65535 total tracked points, the method silently returns
without drawing. Monitor for dropped polylines in scenes with many simultaneous
persistent polylines.
Persistent polylines (duration > 0) are stored in a separate buffer from immediate polylines so that immediate data can be cleared each frame without invalidating persistent index references.
Rectangle(Vector3, Vector2, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a rectangle centered at a position, optionally rotated and filled.
Declaration
public static void Rectangle(Vector3 center, Vector2 size, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the rectangle in world-space or screen-space, depending on
|
| Vector2 | size | The width ( |
| bool | filled | When |
| Color? | color | The color of the rectangle. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the rectangle around its |
| float | duration | How long in seconds the rectangle should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
RegularPolygon(Vector3, float, int, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a regular polygon with the specified number of equally-spaced sides, either filled or as an outline.
Declaration
public static void RegularPolygon(Vector3 center, float radius, int sides, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the polygon in world-space or screen-space, depending on
|
| float | radius | The circumscribed radius - the distance from the center to each vertex. |
| int | sides | The number of sides (and vertices) of the polygon. Values less than |
| bool | filled | When |
| Color? | color | The color of the polygon. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the polygon around its |
| float | duration | How long in seconds the polygon should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Ring(Vector3, float, float, Color?, float, int, Vector3?, float, DebugDrawSpace)
Draws a ring (annulus) as two concentric circle outlines.
Declaration
public static void Ring(Vector3 center, float innerRadius, float outerRadius, Color? color = null, float thickness = -1, int segments = -1, Vector3? normal = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the ring in world-space or screen-space, depending on
|
| float | innerRadius | The radius of the inner circle. When non-positive or (approximately) equal to
|
| float | outerRadius | The radius of the outer circle. If smaller than |
| Color? | color | The color of both circles. Pass |
| float | thickness | The line thickness. Pass |
| int | segments | The number of straight-line segments used to tessellate each circle. Pass
|
| Vector3? | normal | The surface normal of the plane in which the ring lies, interpreted exactly as in
Circle(Vector3, float, bool, Color?, float, int, Vector3?, float, DebugDrawSpace). Pass |
| float | duration | How long in seconds the ring should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Sector(Vector3, float, float, float, Color?, float, int, Vector3?, float, DebugDrawSpace)
Draws a circular sector (a pie slice or vision cone wedge) as a closed wireframe outline: two radius edges connected by an arc.
Declaration
public static void Sector(Vector3 center, float radius, float startAngle, float sweepAngle, Color? color = null, float thickness = -1, int segments = -1, Vector3? normal = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The apex of the sector (the circle center) in world-space or screen-space,
depending on |
| float | radius | The sector radius. Non-positive values draw nothing. |
| float | startAngle | The angle in degrees at which the sector's arc begins, measured counterclockwise from the shape's local +X axis. |
| float | sweepAngle | The angular extent of the sector in degrees. Positive values sweep
counterclockwise, negative values clockwise. Clamped to the range
|
| Color? | color | The color of the outline. Pass |
| float | thickness | The line thickness. Pass |
| int | segments | The number of straight-line segments a full circle would use; the sector's arc
uses a proportional share of them (minimum 2). Pass |
| Vector3? | normal | The surface normal of the plane in which the sector lies, interpreted exactly as
in Circle(Vector3, float, bool, Color?, float, int, Vector3?, float, DebugDrawSpace). Pass |
| float | duration | How long in seconds the sector should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
Remarks
The outline is submitted as a single closed polyline whose first point is the sector apex, so both radius edges are drawn. The sector is wireframe only; a filled variant is deliberately not provided.
See Also
Square(Vector3, float, bool, Color?, float, Quaternion?, float, DebugDrawSpace)
Draws a square (a rectangle with equal width and height) centered at a position. Convenience wrapper around Rectangle(Vector3, Vector2, bool, Color?, float, Quaternion?, float, DebugDrawSpace).
Declaration
public static void Square(Vector3 center, float size, bool filled = false, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the square in world-space or screen-space, depending on
|
| float | size | The side length of the square. |
| bool | filled | When |
| Color? | color | The color of the square. Pass |
| float | thickness | The outline edge thickness. Only used when |
| Quaternion? | rotation | The rotation applied to the square around its |
| float | duration | How long in seconds the square should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for |
See Also
Triangle(Vector3, Vector3, Vector3, bool, Color?, float, float, DebugDrawSpace)
Draws a triangle defined by three vertices, either filled or as an outline.
Declaration
public static void Triangle(Vector3 a, Vector3 b, Vector3 c, bool filled = false, Color? color = null, float thickness = -1, float duration = 0, DebugDrawSpace space = DebugDrawSpace.World)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | a | The first vertex of the triangle. |
| Vector3 | b | The second vertex of the triangle. |
| Vector3 | c | The third vertex of the triangle. |
| bool | filled | When |
| Color? | color | The color of the triangle. Pass |
| float | thickness | The outline edge thickness. Only used when |
| float | duration | How long in seconds the triangle should remain visible. Pass |
| DebugDrawSpace | space | The coordinate space for the vertex positions. Defaults to World. |
WireBox(Vector3, Vector3, Color?, float, Quaternion?, float)
Draws a wireframe box defined by a center position, size, and optional rotation.
Declaration
public static void WireBox(Vector3 center, Vector3 size, Color? color = null, float thickness = -1, Quaternion? rotation = null, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the box in world space. |
| Vector3 | size | The full dimensions of the box along each axis (width, height, depth). Each component is halved to compute the distance from the center to each face. |
| Color? | color | The color of the wireframe edges. Pass |
| float | thickness | The visual thickness of each edge line. Pass |
| Quaternion? | rotation | The rotation applied to the box around its |
| float | duration | How long in seconds the box should remain visible. Pass |
Remarks
The wireframe is composed of 12 individual Line(Vector3, Vector3, Color?, float, float, DebugDrawSpace) calls: 4 edges for
the bottom face, 4 for the top face, and 4 vertical connecting edges. This method
always operates in World and does not accept a
space parameter.
See Also
WireCapsule(in Capsule3D, Color?, float, int, float)
Draws a wireframe capsule from a Capsule3D value. Convenience overload delegating to WireCapsule(Vector3, Vector3, float, Color?, float, int, float).
Declaration
public static void WireCapsule(in Capsule3D capsule, Color? color = null, float thickness = -1, int segments = -1, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Capsule3D | capsule | The capsule geometry to draw. |
| Color? | color | The color of all capsule lines. Pass |
| float | thickness | The visual thickness of the lines. Pass |
| int | segments | The number of segments used to tessellate the rim circles. Pass |
| float | duration | How long in seconds the capsule should remain visible. Pass |
See Also
WireCapsule(Vector3, Vector3, float, Color?, float, int, float)
Draws a wireframe capsule defined by the two centers of its hemispherical caps and a radius. The capsule is composed of two cap rim circles, four side lines, and four hemisphere arcs (two per cap in orthogonal axis planes).
Declaration
public static void WireCapsule(Vector3 pointA, Vector3 pointB, float radius, Color? color = null, float thickness = -1, int segments = -1, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | pointA | The center of the first hemispherical cap in world-space. |
| Vector3 | pointB | The center of the second hemispherical cap in world-space. |
| float | radius | The capsule radius in world units. Non-positive values draw nothing. |
| Color? | color | The color of all capsule lines. Pass |
| float | thickness | The visual thickness of the lines. Pass |
| int | segments | The number of segments used to tessellate the full rim circles; the hemisphere
arcs use half this count. Pass |
| float | duration | How long in seconds the capsule should remain visible. Pass |
Remarks
When pointA and pointB are closer than
0.001 units apart the capsule degenerates to a sphere and is drawn via
WireSphere(Vector3, float, Color?, float, int, float) instead. This method always operates in
World.
See Also
WireCone3D(Vector3, Vector3, float, float, Color?, float, int, float)
Draws a wireframe 3D cone from an apex along a direction: a base rim circle plus four edge lines from the apex to the rim. Useful for visualizing vision cones, spotlights, and detection volumes.
Declaration
public static void WireCone3D(Vector3 apex, Vector3 direction, float length, float angleDegrees, Color? color = null, float thickness = -1, int segments = -1, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | apex | The tip of the cone in world-space. |
| Vector3 | direction | The direction the cone opens toward (from apex to base center). Does not need to be normalized. A (near) zero-length direction draws nothing. |
| float | length | The distance from the apex to the base plane along |
| float | angleDegrees | The full opening angle of the cone in degrees (apex angle, not half-angle). Non-positive values draw nothing; values of 179 or more are clamped to 179. |
| Color? | color | The color of all cone lines. Pass |
| float | thickness | The visual thickness of the lines. Pass |
| int | segments | The number of segments used to tessellate the base rim circle. Pass |
| float | duration | How long in seconds the cone should remain visible. Pass |
Remarks
The base radius is derived from the opening angle as
length * tan(angleDegrees / 2). This method always operates in
World.
See Also
WireSphere(Vector3, float, Color?, float, int, float)
Draws a wireframe sphere approximated by three orthogonal great-circle outlines.
Declaration
public static void WireSphere(Vector3 center, float radius, Color? color = null, float thickness = -1, int segments = -1, float duration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | center | The center of the sphere in world space. |
| float | radius | The radius of the sphere. |
| Color? | color | The color of the wireframe circles. Pass |
| float | thickness | The visual thickness of the circle outlines. Pass |
| int | segments | The number of segments used to tessellate each of the three circles. Pass |
| float | duration | How long in seconds the sphere should remain visible. Pass |
Remarks
The sphere is composed of three Circle(Vector3, float, bool, Color?, float, int, Vector3?, float, DebugDrawSpace) calls in mutually orthogonal
planes: the XY plane (normal Vector3.forward), the XZ plane (normal
Vector3.up), and the YZ plane (normal Vector3.right). This method
always operates in World and does not accept a
space parameter.