docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TMP_TextUtilities

    Inheritance
    object
    TMP_TextUtilities
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: TMPro
    Assembly: Unity.TextMeshPro.dll
    Syntax
    public static class TMP_TextUtilities

    Methods

    DistanceToLine(Vector3, Vector3, Vector3)

    Function returning the Square Distance from a Point to a Line.

    Declaration
    public static float DistanceToLine(Vector3 a, Vector3 b, Vector3 point)
    Parameters
    Type Name Description
    Vector3 a
    Vector3 b
    Vector3 point
    Returns
    Type Description
    float

    FindIntersectingCharacter(TMP_Text, Vector3, Camera, bool)

    Function returning the index of the character at the given position (if any).

    Declaration
    public static int FindIntersectingCharacter(TMP_Text text, Vector3 position, Camera camera, bool visibleOnly)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TextMeshPro component.

    Vector3 position

    Position to check for intersection.

    Camera camera

    The scene camera which is rendering the text or whichever one might be assigned to a Canvas using ScreenSpace Camera or WorldSpace render mode. Set to null is using ScreenSpace Overlay.

    bool visibleOnly

    Only check for visible characters.

    Returns
    Type Description
    int

    FindIntersectingLine(TMP_Text, Vector3, Camera)

    Function returning the line intersecting the position.

    Declaration
    public static int FindIntersectingLine(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text
    Vector3 position
    Camera camera
    Returns
    Type Description
    int

    FindIntersectingLink(TMP_Text, Vector3, Camera)

    Function returning the index of the Link at the given position (if any).

    Declaration
    public static int FindIntersectingLink(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TMP_Text component.

    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

    FindIntersectingWord(TMP_Text, Vector3, Camera)

    Function returning the index of the word at the given position (if any).

    Declaration
    public static int FindIntersectingWord(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TMP_Text component.

    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

    FindNearestCharacter(TMP_Text, Vector3, Camera, bool)

    Function to find the nearest character to position.

    Declaration
    public static int FindNearestCharacter(TMP_Text text, Vector3 position, Camera camera, bool visibleOnly)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TMP Text component.

    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.

    bool visibleOnly

    Only check for visible characters.

    Returns
    Type Description
    int

    FindNearestCharacterOnLine(TMP_Text, Vector3, int, Camera, bool)

    Function returning the nearest character to position on a given line.

    Declaration
    public static int FindNearestCharacterOnLine(TMP_Text text, Vector3 position, int line, Camera camera, bool visibleOnly)
    Parameters
    Type Name Description
    TMP_Text text
    Vector3 position
    int line
    Camera camera
    bool visibleOnly
    Returns
    Type Description
    int

    FindNearestLine(TMP_Text, Vector3, Camera)

    Function returning the line nearest to the position.

    Declaration
    public static int FindNearestLine(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text
    Vector3 position
    Camera camera
    Returns
    Type Description
    int

    FindNearestLink(TMP_Text, Vector3, Camera)

    Function returning the index of the word at the given position (if any).

    Declaration
    public static int FindNearestLink(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TMP_Text component.

    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

    FindNearestWord(TMP_Text, Vector3, Camera)

    Function returning the index of the word at the given position (if any).

    Declaration
    public static int FindNearestWord(TMP_Text text, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    TMP_Text text

    A reference to the TMP_Text component.

    Vector3 position
    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)

    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

    GetHashCode(string)

    Returns the case insensitive hashcode for the given string.

    Declaration
    public static int GetHashCode(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    int

    GetHashCodeCaseInSensitive(string)

    Function which returns a simple hash code from a string converted to uppercase.

    Declaration
    public static uint GetHashCodeCaseInSensitive(string s)
    Parameters
    Type Name Description
    string s

    The string from which to compute the hash code.

    Returns
    Type Description
    uint

    The computed hash code.

    GetSimpleHashCode(string)

    Function which returns a simple hashcode from a string.

    Declaration
    public static int GetSimpleHashCode(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    int

    GetSimpleHashCodeLowercase(string)

    Function which returns a simple hashcode from a string converted to lowercase.

    Declaration
    public static uint GetSimpleHashCodeLowercase(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    uint

    HexToInt(char)

    Function to convert Hex to Int

    Declaration
    public static int HexToInt(char hex)
    Parameters
    Type Name Description
    char hex
    Returns
    Type Description
    int

    IsIntersectingRectTransform(RectTransform, Vector3, Camera)

    Function used to determine if the position intersects with the RectTransform.

    Declaration
    public static bool IsIntersectingRectTransform(RectTransform rectTransform, Vector3 position, Camera camera)
    Parameters
    Type Name Description
    RectTransform rectTransform

    A reference to the RectTranform of 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
    bool

    ScreenPointToWorldPointInRectangle(Transform, Vector2, Camera, out Vector3)

    Method to convert ScreenPoint to WorldPoint aligned with Rectangle

    Declaration
    public static bool ScreenPointToWorldPointInRectangle(Transform transform, Vector2 screenPoint, Camera cam, out Vector3 worldPoint)
    Parameters
    Type Name Description
    Transform transform
    Vector2 screenPoint
    Camera cam
    Vector3 worldPoint
    Returns
    Type Description
    bool

    StringHexToInt(string)

    Function to convert a properly formatted string which contains an hex value to its decimal value.

    Declaration
    public static int StringHexToInt(string s)
    Parameters
    Type Name Description
    string s
    Returns
    Type Description
    int

    ToLowerFast(char)

    Get lowercase version of this ASCII character.

    Declaration
    public static char ToLowerFast(char c)
    Parameters
    Type Name Description
    char c
    Returns
    Type Description
    char

    ToUpperFast(char)

    Get uppercase version of this ASCII character.

    Declaration
    public static char ToUpperFast(char c)
    Parameters
    Type Name Description
    char c
    Returns
    Type Description
    char
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)