Back to API Reference
Class

UniTextSelectionHandles

sealed
Inherits:MonoBehaviour

Shipped Unity-UI presentation used by PrefabSelectionHandles. It instantiates a user-authored prefab for the draggable selection handles (one prefab used for both the anchor and focus carets) and for the collapsed-caret insertion handle, and places each at its caret point. The split of ownership: the prefab owns the look — sprite, colour, material, and the pivot, which alone decides how the handle sits relative to the caret (a teardrop pivots at its tip); the code owns the size, forcing each handle to a square of handleSize dp so the touch target stays a constant physical size across canvases, resolutions, and densities (a fingertip is device-independent). Put Preserve Aspect on the prefab's Image so its sprite fits that square undistorted. Assign its prefab inside a PrefabSelectionHandles entity; geometry is pulled from ActiveEditor at call time, the instances live in a canvas-level overlay so the field's RectMask2D never clips them, and a handle whose caret scrolls outside the field box hides until it returns. A SelectionHandleDragger (drag routing) and a FocusGuard (so grabbing a handle never defocuses the field) are ensured on each instance, so the prefab need only carry a raycastable Graphic.

public Action<Vector2> AnchorDragged
public Action<Vector2> FocusDragged
public Action SelectionHandleDragStarted
public Action SelectionHandleDragEnded
public Action<Vector2> InsertionHandleDragged
public Action InsertionHandleTapped
public Action InsertionHandleDragStarted
public Action InsertionHandleDragEnded