Description
Custom 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.
ArrowCap |
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. |
CircleCap |
Draw a camera-facing Circle. Pass this into handle functions. |
ClearCamera |
Clears the camera. |
ConeCap |
Draw a Cone. Pass this into handle functions. |
CubeCap |
Draw a cube. Pass this into handle functions. |
CylinderCap |
Draw a Cylinder. Pass this into handle functions. |
Disc |
Make a 3D disc that can be dragged with the mouse. |
DotCap |
Draw a camera-facing dot. Pass this into handle functions. |
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. |
DrawLine |
Draw a line from p1 to p2. |
DrawPolyLine |
Draw a line going through the list of all points. |
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. |
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. |
Label |
Make a text label positioned in 3D space. |
PositionHandle |
Make a 3D Scene view position handle. |
RadiusHandle |
Make a Scene view radius handle. |
RotationHandle |
Make a Scene view rotation handle. |
ScaleHandle |
Make a Scene view scale handle. |
ScaleSlider |
Make a directional scale slider. |
ScaleValueHandle |
Make a single-float draggable handle. |
SelectionFrame |
Draw a camera facing selection frame. |
SetCamera |
Set the current camera so all Handles and Gizmos are draw with its settings. |
Slider |
Make a 3D slider. |
Slider2D |
Slide a handle in a 2D plane. |
SnapValue |
Rounds the value val to the closest multiple of snap (snap can only be posiive). |
SphereCap |
Draw a Sphere. Pass this into handle functions. |