Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEditor
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.
CloseFor 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.
CloseCustom 3D GUI controls and drawing in the scene view.
Handles are the 3D controls that Unity uses to manipulate items in the scene view. There are a number of built-in Handle GUIs, such as the familiar tools to position, scale and rotate an object via the Transform component. However, it is also possible to define your own Handle GUIs to use with custom component editors. Such GUIs can be a very useful way to edit procedurally-generated scene content, "invisible" items and groups of related objects, such as waypoints and location markers.
You can also supplement the 3D Handle GUI in the scene with 2D buttons and other controls overlaid on the scene view. This is done by enclosing standard Unity GUI calls in a Handles.BeginGUI / EndGUI pair within the //OnSceneGUI// function. You can use HandleUtility.GUIPointToWorldRay and HandleUtility.WorldToGUIPoint to convert coordinates between 2D GUI and 3D world coordinates.
centerColor | Color to use for handles that represent the center of something. |
color | Colors of the handles. |
inverseMatrix | The inverse of the matrix for all handle operations. |
lighting | Are handles lit? |
matrix | Matrix for all handle operations. |
preselectionColor | Color to use to highlight an unselected handle currently under the mouse pointer. |
secondaryColor | Soft color to use for for general things. |
selectedColor | Color to use for the currently active handle. |
xAxisColor | Color to use for handles that manipulates the X coordinate of something. |
yAxisColor | Color to use for handles that manipulates the Y coordinate of something. |
zAxisColor | Color to use for handles that manipulates the Z coordinate of something. |
zTest | zTest of the handles. |
currentCamera | Setup viewport and stuff for a current camera. |
ArrowHandleCap | Draw an arrow like those used by the move tool. |
BeginGUI | Begin a 2D GUI block inside the 3D handle GUI. |
Button | Make a 3D Button. |
CircleHandleCap | Draw a circle handle. Pass this into handle functions. |
ClearCamera | Clears the camera. |
ConeHandleCap | Draw a cone handle. Pass this into handle functions. |
CubeHandleCap | Draw a cube handle. Pass this into handle functions. |
CylinderHandleCap | Draw a cylinder handle. Pass this into handle functions. |
Disc | Make a 3D disc that can be dragged with the mouse. Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles. |
DotHandleCap | Draw a dot handle. Pass this into handle functions. |
DrawAAConvexPolygon | Draw anti-aliased convex polygon specified with point array. |
DrawAAPolyLine | Draw anti-aliased line specified with point array and width. |
DrawBezier | Draw textured bezier line through start and end points with the given tangents. To get an anti-aliased effect use a texture that is 1x2 pixels with one transparent white pixel and one opaque white pixel. The bezier curve will be swept using this texture. |
DrawCamera | Draws a camera inside a rectangle. |
DrawDottedLine | Draw a dotted line from p1 to p2. |
DrawDottedLines | Draw a list of dotted line segments. |
DrawLine | Draw a line from p1 to p2. |
DrawLines | Draw a list of line segments. |
DrawPolyLine | Draw a line going through the list of all points. |
DrawSelectionFrame | Draw a camera facing selection frame. |
DrawSolidArc | Draw a circular sector (pie piece) in 3D space. |
DrawSolidDisc | Draw a solid flat disc in 3D space. |
DrawSolidRectangleWithOutline | Draw a solid outlined rectangle in 3D space. |
DrawWireArc | Draw a circular arc in 3D space. |
DrawWireCube | Draw a wireframe box with center and size. |
DrawWireDisc | Draw the outline of a flat disc in 3D space. |
EndGUI | End a 2D GUI block and get back to the 3D handle GUI. |
FreeMoveHandle | Make an unconstrained movement handle. |
FreeRotateHandle | Make an unconstrained rotation handle. |
GetMainGameViewSize | Get the width and height of the main game view. |
Label | Make a text label positioned in 3D space. |
MakeBezierPoints | Retuns an array of points to representing the bezier curve. See Handles.DrawBezier. |
PositionHandle | Make a position handle. |
RadiusHandle | Make a Scene view radius handle. |
RectangleHandleCap | Draw a rectangle handle. Pass this into handle functions. |
RotationHandle | Make a Scene view rotation handle. |
ScaleHandle | Make a Scene view scale handle.Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles. |
ScaleSlider | Make a directional scale slider. |
ScaleValueHandle | Make a 3D handle that scales a single float. |
SetCamera | Set the current camera so all Handles and Gizmos are draw with its settings. |
Slider | Make a 3D slider that moves along one axis. |
Slider2D | Make a 3D slider that moves along a plane defined by two axes. |
SnapValue | Rounds the value val to the closest multiple of snap (snap can only be positive). |
SphereHandleCap | Draw a sphere handle. Pass this into handle functions. |
CapFunction | The function to use for drawing the handle e.g. Handles.RectangleCap. |
SizeFunction | A delegate type for getting a handle's size based on its current position. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information