docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Drawing 3D utility reference

    Find the primitives the Drawing3d immediate-mode canvas provides.

    Drawing3d is an immediate-mode 3D drawing canvas. Create one with Drawing3d.Create(duration, material), where a negative duration persists the drawing indefinitely. As you accumulate geometry, Drawing3d batches it into a single mesh, uploaded each LateUpdate by Drawing3dManager. Call Clear() to remove all accumulated geometry before a redraw. To use Drawing3d from within a visualizer, refer to Write a custom visualizer.

    Drawing primitives

    Drawing3d exposes the following methods for accumulating geometry:

    Method Draws
    DrawLine A solid line between two points, with a uniform color or a per-endpoint color gradient.
    DrawPath A continuous tube-like path through a series of points, with mitered corners.
    DrawLineStrip A connected strip of line segments through a series of points.
    DrawLines Multiple disconnected line segments from consecutive point pairs.
    DrawPoint A small octahedron at a point, optionally with a 3D text label.
    DrawArrow A line with a cone arrowhead at the tip.
    DrawQuad A flat quadrilateral defined by four vertices.
    DrawTriangle A single triangle, with a uniform color or per-vertex colors.
    DrawTriangleFan A series of triangles sharing a common center vertex.
    DrawTriangleStrip A sequence of triangles where each new point forms a triangle with the two preceding points.
    DrawCuboid An axis-aligned or rotated cuboid from a center and half-extents.
    DrawParallelepiped A parallelepiped (generalized box) from a center and three edge vectors.
    DrawSphere A uniform sphere.
    DrawSpheroid An ellipsoid with independent per-axis radii and an optional rotation.
    DrawCircle A double-sided filled circle (disc) with a given normal direction.
    DrawCircleOneSided A single-sided filled circle, visible only from the side the normal faces.
    DrawCylinder A capped cylinder between two endpoint positions, with a uniform color or separate colors per end.
    DrawCone A cone with a filled base disc and an apex position.
    DrawMesh A mesh instance at a position, rotation, and scale, tinted with a color or using an explicit material.
    AddPointCloud A PointCloudDrawing for rendering large point sets.
    DrawLabel Screen-space text rendered at a 3D world position.

    TF tracking

    Placement relative to the ROS TF hierarchy is controlled by TFTrackingSettings, which combines a TFTrackingType with an optional override TF system component:

    TFTrackingType Placement
    None Not parented to any TF frame; remains under the Drawing3dManager root.
    Exact Placed at the exact TF frame position and orientation recorded when the message was received.
    TrackLatest Parented to the live TF frame object, so it follows subsequent transform updates.
    RelativeToVisualizer Parented to the visualizer component's own transform.

    Shaders

    Drawing3d ships its own shaders under Drawing3d/Shaders/:

    Shader Use
    UnlitVertexColor Opaque geometry, tinted per-vertex. The default for solid primitives.
    UnlitVertexColorAlpha Per-vertex color with a uniform, fadeable transparency.
    UnlitColorAlpha A single uniform, semi-transparent color.
    UnlitPointCloudAdditive Point clouds, blended additively so overlapping points brighten.
    UnlitPointCloudCutout Point clouds, alpha-tested so points render as opaque discs with hard edges.

    Additional resources

    • Write a custom visualizer
    • Introduction to visualization
    • Built-in visualizer reference
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)