Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ITextSelection

Interface to access a TextElement selection and cursor information This interface is not meant to be implemented explicitly as its declaration might change in the future.
Read time 1 minuteLast updated 5 days ago

Definition

public interface ITextSelection

Properties

Property

Description

cursorIndexThis is the cursor index in the text presented.
cursorPositionThe position of the text cursor inside the element's _contentRect.
doubleClickSelectsWordControls whether double-clicking selects the word under the mouse pointer.
isSelectableReturns true if the field is selectable.
selectAllOnFocusControls whether the element's content is selected upon receiving focus.
selectAllOnMouseUpControls whether the element's content is selected when you mouse up for the first time.
selectIndexThis is the selection index in the text presented.
tripleClickSelectsLineControls whether triple-clicking selects the entire line under the mouse pointer.

Methods

Method

Description

GetCursorPositionFromStringIndexThe position inside the element's content box where the text cursor would be if it were at the selected index.
HasSelectionReturn true is the TextElement has a selection.
MoveBackwardMoves the cursor backward by one character.
MoveForwardMoves the cursor forward by one character.
MoveToEndOfPreviousWordMoves the cursor to the end of the previous word.
MoveToParagraphEndMoves the cursor to the end of the current paragraph.
MoveToParagraphStartMoves the cursor to the start of the current paragraph.
MoveToStartOfNextWordMoves the cursor to the start of the next word.
MoveWordBackwardMoves one word backward.
MoveWordForwardMoves one word forward.
SelectAllSelects all the text contained in the field.
SelectNoneRemove selection
SelectRangeSelect text between cursorIndex and selectIndex.

Events

Member

Description

OnCursorIndexChangeEvent that is triggered when the cursor index changes.
OnSelectIndexChangeEvent that is triggered when the selection index changes.