Method GetCursorIndexFromPosition
GetCursorIndexFromPosition(TMP_Text, Vector3, Camera)
Function returning the index of the character whose origin is closest to the cursor.
Declaration
public static int GetCursorIndexFromPosition(TMP_Text textComponent, Vector3 position, Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_Text | textComponent | A reference to the text object. |
| Vector3 | position | Position to check for intersection. |
| Camera | camera | The scene camera which may be assigned to a Canvas using ScreenSpace Camera or WorldSpace render mode. Set to null is using ScreenSpace Overlay. |
Returns
| Type | Description |
|---|---|
| int |
GetCursorIndexFromPosition(TMP_Text, Vector3, Camera, out CaretPosition)
Function returning the index of the character whose origin is closest to the cursor.
Declaration
public static int GetCursorIndexFromPosition(TMP_Text textComponent, Vector3 position, Camera camera, out CaretPosition cursor)
Parameters
| Type | Name | Description |
|---|---|---|
| TMP_Text | textComponent | A reference to the text object. |
| Vector3 | position | Position to check for intersection. |
| Camera | camera | The scene camera which may be assigned to a Canvas using ScreenSpace Camera or WorldSpace render mode. Set to null is using ScreenSpace Overlay. |
| CaretPosition | cursor | The position of the cursor insertion position relative to the position. |
Returns
| Type | Description |
|---|---|
| int |