HandleUtility Manual     Reference     Scripting  
Scripting > Editor Classes > HandleUtility
HandleUtility Class

Helper functions for Scene View style 3D GUI

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

Class Variables
acceleration

Get standard acceleration for dragging values (Read Only).

niceMouseDelta

Get nice mouse delta to use for dragging a float value (Read Only).

niceMouseDeltaZoom

Get nice mouse delta to use for zooming (Read Only).

nearestControl

Class Functions
CalcLineTranslation

Helper function for doing arrows.

ProjectPointLine

Project point onto a line.

DistancePointLine

Calculate distance between a point and a line.

DistanceToLine

Pixel distance from mouse pointer to line.

DistanceToCircle

Pixel distance from mouse pointer to camera facing circle.

DistanceToDisc

Pixel distance from mouse pointer to a 3D disc.

ClosestPointToDisc

Get the nearest 3D point.

DistanceToArc

Pixel distance from mouse pointer to a 3D section of a disc.

ClosestPointToArc

Get the nearest 3D point.

DistanceToPolyLine

Pixel distance from mouse pointer to a polyline.

ClosestPointToPolyLine

Get the nearest 3D point.

AddControl

Record a distance measurement from a handle.

AddDefaultControl

Add the ID for a default control. This will be picked if nothing else is

GetHandleSize

Get world space size of a manipulator handle at given position.

WorldToGUIPoint

Convert world space point to a 2D GUI position.

GUIPointToWorldRay

Convert 2D GUI position to a world space ray.

WorldPointToSizedRect

Figure out a rectangle to display a 2D GUI element in 3D space.

PickGameObject

Pick game object closest to specified position.

PushCamera

Store all camera settings

PopCamera

Retrieve all camera settings

RaySnap

Casts ray against the scene.

Repaint

Repaint the current view