Legacy Documentation: Version 5.2
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Gizmos

class in UnityEngine

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

Sumbission failed

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

Close

Cancel

Switch to Manual

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 Variables

colorSets the color for the gizmos that will be drawn next.
matrixSet the gizmo matrix used to draw all gizmos.

Static Functions

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.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961