Skip to content
yart edited this page Sep 1, 2026 · 4 revisions

We have some convenient methods for quickly drawing various depth-indicating gizmos.

TODO: finish and explain how easy GizmoSettings or w/e is to implement

Extensions

You can call these methods from a Component.

  • this.DrawBox( ... )
  • this.DrawArrow( ... )
  • this.DrawSphere( ... )
  • this.DrawCapsule( ... )
  • this.DrawCylinder( ... )

Depth Indication

Depth is indicated in these methods by rendering a shape with the specified color very transparently without depth testing(through walls), then again with depth testing using the full color.

This simple technique lets you know something's there even through walls and how much of it is stuck through the floor or whatever.

Recommended Usage

From a Component, in OnUpdate or DrawGizmos just type this.DrawBox(...) for example.

You can specify only the shape's properties and color and it will(by default) render the shape using the position/rotation/scale of the Component you called the method from(the GameObject it's on to be more accurate). You can however override where it's at by typing tWorld: .. as an argument in the method.

If you want your render code to show ingame then call the methods in OnUpdate. If you want the same code to show in the editor then you can have your component inherit Component.ExecuteInEditor, but you likely want have features meant only for play mode prevented in the editor with:

if ( !this.InGame() )
 return;

Clone this wiki locally