value | The value the user can modify. |
position | The position of the handle. |
rotation | The rotation of the handle. |
size | The size of the handle. |
capFunc | The function to use for drawing the handle e.g. Handles.RectangleCap. |
snap | The new value after the user has modified it. Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles. |
Make a single-float draggable handle.
// Increase/decrease a value just by moving an Arrow Handle @CustomEditor (ScaleValueModifier) class ScaleValue extends Editor { function OnSceneGUI () { target.floatVal = Handles.ScaleValueHandle(target.floatVal, target.transform.position, Quaternion.identity, 30, Handles.ArrowCap, 1); if (GUI.changed) EditorUtility.SetDirty (target); } }
// ScaleValueModifier.js // Usage: Place this script on the Game Object // you want to modify "floatVal" by dragging the Arrow Handle @script ExecuteInEditMode() var floatVal : float = 1; function Update() { Debug.Log("Value Modified: " + floatVal); }