Table of Contents

Struct TextAlign

Controls how text is anchored and aligned in relation to its position.

public struct TextAlign

Constructors

TextAlign(float2, TextJustification)

Returns the defaultAlign, but with the anchor and justification set.

public TextAlign(float2 anchor, TextJustification justification)

Parameters

anchor float2
justification TextJustification

TextAlign(float2, TextJustification, float2)

public TextAlign(float2 anchor, TextJustification justification = TextJustification.Left, float2 offset = default)

Parameters

anchor float2
justification TextJustification
offset float2

TextAlign(float2, float2)

Returns the defaultAlign, but with the anchor and offset set.

public TextAlign(float2 anchor, float2 offset)

Parameters

anchor float2
offset float2

Fields

BottomCenter

public static readonly TextAlign BottomCenter

Field Value

TextAlign

BottomLeft

public static readonly TextAlign BottomLeft

Field Value

TextAlign

BottomRight

public static readonly TextAlign BottomRight

Field Value

TextAlign

MiddleCenter

public static readonly TextAlign MiddleCenter

Field Value

TextAlign

MiddleLeft

public static readonly TextAlign MiddleLeft

Field Value

TextAlign

MiddleRight

public static readonly TextAlign MiddleRight

Field Value

TextAlign

TopCenter

public static readonly TextAlign TopCenter

Field Value

TextAlign

TopLeft

public static readonly TextAlign TopLeft

Field Value

TextAlign

TopRight

public static readonly TextAlign TopRight

Field Value

TextAlign

anchor

Where to anchor the text.
0 = Left/Top, 1 = Right/Bottom.

public float2 anchor

Field Value

float2

justification

How to align multiple lines of text.

public TextJustification justification

Field Value

TextJustification

offset

Gives an absolute offset from the anchor position.

public float2 offset

Field Value

float2

Methods

WithAnchor(float2)

Returns a copy of this alignment with the given anchor.

public TextAlign WithAnchor(float2 anchor)

Parameters

anchor float2

Returns

TextAlign

WithJustification(TextJustification)

Returns a copy of this alignment with the given justification.

public TextAlign WithJustification(TextJustification justification)

Parameters

justification TextJustification

Returns

TextAlign

WithOffset(float2)

Returns a copy of this alignment with the given offset.

public TextAlign WithOffset(float2 offset)

Parameters

offset float2

Returns

TextAlign

Operators

implicit operator TextAlign(TextJustification)

public static implicit operator TextAlign(TextJustification justification)

Parameters

justification TextJustification

Returns

TextAlign

implicit operator TextAlign(float2)

public static implicit operator TextAlign(float2 anchor)

Parameters

anchor float2

Returns

TextAlign