Scripting API

TMP_TextUtilities

static class in TMPro · Unity.TextMeshPro

21 of 21 of Unity's members
In Tassix

Finding what in a text is under a screen position (characters, words, lines; links aren't parsed yet, so none are found), and the hashes TextMesh Pro names things by.

Methods 21

static float DistanceToLine(Vector3 a, Vector3 b, Vector3 point)

The squared distance from a point to the segment from a to b.

static int FindIntersectingCharacter(TMP_Text text, Vector3 position, Camera camera, bool visibleOnly)
static int FindIntersectingLine(TMP_Text text, Vector3 position, Camera camera)
static int FindIntersectingWord(TMP_Text text, Vector3 position, Camera camera)
static int FindNearestCharacter(TMP_Text text, Vector3 position, Camera camera, bool visibleOnly)
static int FindNearestCharacterOnLine(TMP_Text text, Vector3 position, int line, Camera camera, bool visibleOnly)
static int FindNearestLine(TMP_Text text, Vector3 position, Camera camera)
static int FindNearestWord(TMP_Text text, Vector3 position, Camera camera)
static int GetCursorIndexFromPosition(TMP_Text textComponent, Vector3 position, Camera camera)
static int GetCursorIndexFromPosition(TMP_Text textComponent, Vector3 position, Camera camera, out CaretPosition cursor)
static int GetHashCode(string s)

A case-insensitive hash (h = h * 33 ^ upper(c), from 0).

static uint GetHashCodeCaseInSensitive(string s)
static int GetSimpleHashCode(string s)

A case-sensitive hash (h = h * 33 ^ c, from 0): the hash link IDs and tags go by.

static uint GetSimpleHashCodeLowercase(string s)
static int HexToInt(char hex)

A hex digit's value; 15 for anything else.

static bool IsIntersectingRectTransform(RectTransform rectTransform, Vector3 position, Camera camera)
static bool ScreenPointToWorldPointInRectangle(Transform transform, Vector2 screenPoint, Camera cam, out Vector3 worldPoint)

Where the ray through a screen point meets the transform's plane (z = 0 locally).

static int StringHexToInt(string s)
static char ToLowerFast(char c)

A–Z to a–z; other characters unchanged.

static char ToUpperFast(char c)

a–z to A–Z; other characters unchanged.

Checked against Unity

Conformance scenarios that exercise it, recorded in Unity and compared event by event.