Gizmos Utilities - BluePixelDev/utilkit GitHub Wiki
The GizmosUtil
class provides helpful methods to draw 3D shapes and polylines using Unity’s Gizmos
API. These tools are useful for visual debugging in the Unity Editor scene view.
DrawCylinder(Vector3 center, float radius, float height)
Draws a vertical cylinder using a set of vertical lines and circular caps.
- center: World-space center of the cylinder.
- radius: Radius of the circular base.
- height: Half-height of the cylinder (drawn symmetrically above and below the center).
GizmosUtil.DrawCylinder(transform.position, 1f, 2f);
This method:
- Draws vertical lines around the perimeter.
- Caps the top and bottom with circles using
DrawCircle
.
DrawCircle(Vector3 center, float radius)
Draws a flat circle on the XZ plane using line segments.
- center: Center of the circle.
- radius: Radius of the circle.
GizmosUtil.DrawCircle(transform.position, 1.5f);
- Internally uses 12 segments for a smooth approximation.
- Can be used independently or with
DrawCylinder
.