Version: 2021.1
LanguageEnglish
  • C#

Gizmos

class in UnityEngine

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Gizmos are used to give visual debugging or setup aids in the Scene view.

All gizmo drawing has to be done in either OnDrawGizmos or OnDrawGizmosSelected functions of the script.
OnDrawGizmos is called every frame. All gizmos rendered within OnDrawGizmos are pickable. OnDrawGizmosSelected is called only if the object the script is attached to is selected.

Static Properties

colorSets the color for the gizmos that will be drawn next.
exposureSet a texture that contains the exposure correction for LightProbe gizmos. The value is sampled from the red channel in the middle of the texture.
matrixSets the Matrix4x4 that the Unity Editor uses to draw Gizmos.
probeSizeSet a scale for Light Probe gizmos. This scale will be used to render the spherical harmonic preview spheres.

Static Methods

DrawCubeDraw a solid box with center and size.
DrawFrustumDraw a camera frustum using the currently set Gizmos.matrix for it's location and rotation.
DrawGUITextureDraw a texture in the Scene.
DrawIconDraw an icon at a position in the Scene view.
DrawLineDraws a line starting at from towards to.
DrawMeshDraws a mesh.
DrawRayDraws a ray starting at from to from + direction.
DrawSphereDraws a solid sphere with center and radius.
DrawWireCubeDraw a wireframe box with center and size.
DrawWireMeshDraws a wireframe mesh.
DrawWireSphereDraws a wireframe sphere with center and radius.