Struct TMP_Offset
Represents padding or offset values (left, right, top, bottom) for text layout.
Namespace: TMPro
Assembly: Unity.TextMeshPro.dll
Syntax
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
horizontal
Declaration
public float horizontal { get; set; }
Property Value
left
Declaration
public float left { get; set; }
Property Value
right
Declaration
public float right { get; set; }
Property Value
top
Declaration
public float top { get; set; }
Property Value
vertical
Declaration
public float vertical { get; set; }
Property Value
zero
A TMP_Offset with all values set to zero.
Declaration
public static TMP_Offset zero { get; }
Property Value
Methods
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
Equals(TMP_Offset)
Declaration
public bool Equals(TMP_Offset other)
Parameters
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
Operators
operator ==(TMP_Offset, TMP_Offset)
Declaration
public static bool operator ==(TMP_Offset lhs, TMP_Offset rhs)
Parameters
Returns
operator !=(TMP_Offset, TMP_Offset)
Declaration
public static bool operator !=(TMP_Offset lhs, TMP_Offset rhs)
Parameters
Returns
operator *(TMP_Offset, float)
Declaration
public static TMP_Offset operator *(TMP_Offset a, float b)
Parameters
Returns