docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct TMP_Offset

    Represents padding or offset values (left, right, top, bottom) for text layout.

    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: TMPro
    Assembly: Unity.TextMeshPro.dll
    Syntax
    public struct TMP_Offset
    Remarks

    Used by TextMesh Pro for margin, padding, and underline/overhang offsets. Set horizontal or vertical to apply the same value to both sides (e.g. left and right).

    Examples

    Use for text margins or custom layout. Create with horizontal and vertical or with separate left, right, top, and bottom values.

    TMP_Offset margin = new TMP_Offset(10f, 5f); // left/right 10, top/bottom 5
    TMP_Offset padding = new TMP_Offset(2f, 2f, 2f, 2f);

    Constructors

    TMP_Offset(float, float)

    Creates a TMP_Offset with the same horizontal value for left/right and same vertical value for top/bottom.

    Declaration
    public TMP_Offset(float horizontal, float vertical)
    Parameters
    Type Name Description
    float horizontal

    The horizontal offset applied to both left and right edges.

    float vertical

    The vertical offset applied to both top and bottom edges.

    TMP_Offset(float, float, float, float)

    Creates a TMP_Offset with the given left, right, top, and bottom values.

    Declaration
    public TMP_Offset(float left, float right, float top, float bottom)
    Parameters
    Type Name Description
    float left

    The left edge offset value for the layout.

    float right

    The right edge offset value for the layout.

    float top

    The top edge offset value for the layout.

    float bottom

    The bottom edge offset value for the layout.

    Properties

    bottom

    Declaration
    public float bottom { get; set; }
    Property Value
    Type Description
    float

    horizontal

    Declaration
    public float horizontal { get; set; }
    Property Value
    Type Description
    float

    left

    Declaration
    public float left { get; set; }
    Property Value
    Type Description
    float

    right

    Declaration
    public float right { get; set; }
    Property Value
    Type Description
    float

    top

    Declaration
    public float top { get; set; }
    Property Value
    Type Description
    float

    vertical

    Declaration
    public float vertical { get; set; }
    Property Value
    Type Description
    float

    zero

    A TMP_Offset with all values set to zero.

    Declaration
    public static TMP_Offset zero { get; }
    Property Value
    Type Description
    TMP_Offset

    Methods

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    Equals(TMP_Offset)

    Declaration
    public bool Equals(TMP_Offset other)
    Parameters
    Type Name Description
    TMP_Offset other
    Returns
    Type Description
    bool

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    Operators

    operator ==(TMP_Offset, TMP_Offset)

    Declaration
    public static bool operator ==(TMP_Offset lhs, TMP_Offset rhs)
    Parameters
    Type Name Description
    TMP_Offset lhs
    TMP_Offset rhs
    Returns
    Type Description
    bool

    operator !=(TMP_Offset, TMP_Offset)

    Declaration
    public static bool operator !=(TMP_Offset lhs, TMP_Offset rhs)
    Parameters
    Type Name Description
    TMP_Offset lhs
    TMP_Offset rhs
    Returns
    Type Description
    bool

    operator *(TMP_Offset, float)

    Declaration
    public static TMP_Offset operator *(TMP_Offset a, float b)
    Parameters
    Type Name Description
    TMP_Offset a
    float b
    Returns
    Type Description
    TMP_Offset
    In This Article
    Back to top
    Copyright © 2026 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)