UniTextSelectable
Selection capability for UniTextBase: caret + range state with explicit affinity, gesture interpretation (multi-click promotion, drag-to-select, word-by-word drag, context-menu coordination), and highlight rendering. Sits on the same GameObject as UniTextBase; requires an existing UniText or UniTextWorld — RequireComponent validates the dependency but cannot auto-add the abstract base, so add the text component first.
Remarks
MultiClickMaxInterval, MultiClickMaxDistance). Single = caret, double = word, triple = paragraph. Touch-side multi-tap thresholds (different from desktop) are fed in via DispatchTap / DispatchDoubleTap / DispatchTripleTap by the gesture recogniser, which applies its own timing.Maximum distance between consecutive primary clicks for multi-click detection, in density-independent pixels (Android dp, 160 dpi baseline) — the comparison scales by the display density at use so the physical slop stays constant on high-density displays. Defaults to 8.
public UniTextBase TextComponent{ get }The display component this selection layer operates over. Same GameObject; lazily resolved via GetComponent<T> on first access so layout / preferred-height queries from the Unity layout system work identically in edit mode and play mode (the runtime path is the single path — no edit-time branch).
public TextSelection Selection{ get }Current selection state (anchor / focus / affinity). Immutable.
True while word-by-word drag is active (started by a double-click on text). Drag extension snaps to whole-word boundaries instead of individual codepoints. Read by the touch gesture pipeline to decide whether to start a fresh caret-drag or continue extending the word selection.
public OrderedValueEvent<SelectionChangingArgs> SelectionChanging{ get }Occurs when Selection is about to change through any of the public mutators (SetCaret / SetSelection / ExtendSelection / Select* / Click+drag dispatchers). Subscribers may set Cancel to abort, or assign Proposed to clamp into a permitted range (P2.A atomic-token boundary, integrator-defined read-only ranges). Side-effect movements driven by text mutation (insert / delete / IME commit / undo) bypass this event by design — they go through an internal non-vetoable path. See SelectionChangingArgs. Callbacks run by ascending order and equal orders retain subscription order.
Moves one selection endpoint to codepointIndex with the touch selection-handle contract (iOS / Android): the selection never collapses — when the dragged endpoint lands on the fixed one it is clamped one grapheme cluster away — and dragging past the fixed endpoint is allowed, inverting the anchor / focus orientation (the handles swap roles). draggingAnchor selects which endpoint moves; the other stays fixed.
Programmatic primary-click driver — runs the same press gesture the pointer pipeline uses (HandlePressGesture): single places the caret, double selects the word, triple the paragraph; Shift extends. Affinity defaults downstream — the bounding-box TextHitResult carries none.
public Action<SelectionChangedArgs> SelectionChangedPost-change notification with previous and current state plus a hierarchical UserEvent string. See SelectionChangedArgs for category strings.
public Action<TextPointerEvent> SelectionDragStartedOccurs when a pointer drag has been routed to selection (mouse / pen always; touch only in an armed selection gesture — see the class drag policy). The event is anchored at the press position, not the position where the drag threshold was crossed. The instance is reused across emissions and Hit is not computed — hit-test from ScreenPosition.
public Action<TextPointerEvent> SelectionDragUpdatedpublic Action<TextPointerEvent> SelectionDragEndedpublic Action ContextMenuDismissRequestedOccurs when an open context menu should hide (drag, scroll, edit, focus loss).
